📜 ⬆️ ⬇️

Are you still using CJSON?

Are you still using CJSON ? If not, this short note is not for you.

The CJSON library is known to developers working with the Yii framework (versions older than 2.x). And it seems to be a logical wave to use in projects on Yii what the developers themselves recommend of this, in general, quite good framework.

In principle, I thought it would be right to use this library if it already comes with the framework. Why not?
')
But why "no":



Test standard JSON extension in PHP:

Input size, kb : 866.55
MEM, kb : 13363.2
Time, msec : 0.0292

CJSON test:

Input size, kb: 866.55
MEM, kb: 12006.4
Time, msec: 1,9649


Where Input size is the size of the string in the json format that comes in at the input.

In both cases, two successive operations fell under the measurements: decode and encode the resulting object. For the purity of the experiment, the averaged values ​​for 10 iterations are shown.

Draw your own conclusions.

And yes, are you still using CJSON?

UPD: Updated statistics. Memory_get_usage () with the true parameter is used to calculate the consumed RAM. Also calculated averages for 10 iterations.

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


All Articles