Closed (fixed)
Project:
Advanced CSS/JS Aggregation
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 Jun 2015 at 17:29 UTC
Updated:
16 Jul 2015 at 16:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
joelpittetComment #3
joelpittetThings must have changed... let's test against stable.
Comment #5
mikeytown2 commentedAccording to this json_encode() is faster once you're dealing with a LARGE amount of data (70+ MB)
http://techblog.procurios.nl/k/n618/news/view/34972/14863/cache-a-large-...
All said and done we're talking about a sub ms improvement here if json_encode is indeed faster.
In this case I'll need some proof that json_encode is faster than serialize inside advagg.
Comment #7
mikeytown2 commentedIf you flip json and serialize around so json goes first, serialize ends up being faster
Running each one by its self is a better way to test. With that I get that json_encode takes 1/2 the time; an improvement but not as big as what was reported.
Comment #8
mikeytown2 commentedComment #9
joelpittet@mikeytown2 Sorry you are totally right reversed makes that change moot! Thanks for showing me!
Here's my test results which seem more consistent and show json_encode slower!
PHP 5.5 + Opcache
Serialize Run First
JSON Run First
json_encode is now consistently 100-150ms slower regardless of it's order run.
Comment #10
nathanbrauer commentedBoth of your tests have errors.
@mikeytown2's calculates the end-time for json_encode after BOTH json_encode and serialize has processed.
Here is the corrected code: http://nathanbrauer.com/playground/plain-text/json-vs-serialize.php
In action: http://nathanbrauer.com/playground/json-vs-serialize.php
@joelpittet's saves test_json to $sTime and test_serialize to $jTime (backwards).
Here is the corrected code: http://nathanjbrauer.com/playground/plain-text/drupal-calculation.php
In action: http://nathanjbrauer.com/playground/drupal-calculation.php
:)
Comment #11
mikeytown2 commentedWhat happens when you just do json_encode for one request and and serialize for another? Don't run them back to back in the same script. When doing this I found that json_encode is only 50% faster (see the bottom of #7).
Comment #12
joelpittetEdit: more typos... arg. Disregard.
Comment #13
joelpittetSome individual results as asked by @mikeytown2
Code used to generate the results:
Comment #14
joelpittetStill for this module's use-case I think it's only doing the operation maybe ~10 times not 10,000 times. So at best we could save ~1ms.
Fun experiment nontheless:)
Comment #16
mikeytown2 commentedThis is the patch that I committed. Allows one to change the function by setting a variable; so if https://github.com/igbinary/igbinary is installed and it's quicker one can change to that.
Comment #17
joelpittet@mikeytown2 haha, you could just say no, but thank you for the feature:)
Comment #18
mikeytown2 commentedI'll take a 1ms improvement :)