mmlemon / as3corelib

Automatically exported from code.google.com/p/as3corelib
0 stars 0 forks source link

Improve JSON decoder performance #97

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Use Solution 2 from this link to greatly improve JSON decoder performance.
http://www.adobe.com/cfusion/communityengine/index.cfm?
event=showdetails&productId=2&postId=13226

Original issue reported on code.google.com by dasa.pad...@gmail.com on 25 Feb 2009 at 1:19

GoogleCodeExporter commented 8 years ago
I've tried to apply the optimizations outlined in that article, but they 
actually turn out to be slower than the 
current implementation.  I've attached a patch to illustrate the changes I was 
using.

For 10k rows, the patched version is 20-50ms slower on my machine.

If I remove the error checking, then this version is indeed faster, but then 
the parser is no longer correct.  
Since the overall goal of this library is to be correct, I do not feel 
comfortable sacrificing correctness for speed 
in this case.

I also tried using regular expressions to break some things apart, but that 
ends up being MUCH slower, 
especially on larger strings.  The regular expression engine doesn't seem to 
perform well in my testing of 
large strings.

Original comment by darron.schall on 4 Aug 2009 at 12:57

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by darron.schall on 4 Aug 2009 at 12:57

GoogleCodeExporter commented 8 years ago
In testing again, it looks like the patched version actually is faster by 100ms 
or so on my 10k records test.  My 
mistake.  I also made a slight mistake in the patch that was causing the unit 
tests to fail, but have corrected that 
before check-in.

These changes have been made in r95.  All of the unit tests continue to pass.  
However, if anyone runs into 
errors, please file additional issues with reproducible test cases so I can 
expand the test cases.

Original comment by darron.schall on 4 Aug 2009 at 1:09