📜 ⬆️ ⬇️

unserialize vs include

To optimize the engine I decided to check that it will work faster: unserialize + file_get_contents or include the generated php file.
Serialized array takes 10kb.
Testing was conducted to unserialize, connect the file and retrieve data from the mysql database.

At first I thought that the fastest way was to connect the generated php file. Tests showed a different result.
Accelerators were not used, tests were carried out 5 times, the maximum and minimum values ​​were discarded and the average result was taken



Blue graph - using serialized data
Red graph - use connection generated php file
Green graph - getting data from the database
Purple Graphic - using eAccelerator

From the graph it can be seen that with an increase in the number of iterations, the time for one iteration does not change and the speed of unserialize is much higher than connecting a php file
')

UPD


By requests put eAccelerator

Slower than using unserialize + file_get_contents
Iteration 10,000 for eAccelerator running out of memory
I can’t explain the result with eAccelerator enabled

Source: https://habr.com/ru/post/70090/


All Articles