Closed oxyc closed 11 years ago
I updated the jsperf tests with these two commits. http://jsperf.com/json3/21
There's still some performance to be gained by converting evertyhing in lex() to character codes. If you decide you want this, I can convert the rest as well.
This is amazing—thank you so much, @oxyc! Merged into the v3.2.5
branch. I'll have access to my test VMs on Monday, and will run the jsPerf tests then.
I went ahead and converted the remaining strings to character codes, as you suggested. Thanks again!
In browsers string operations are quite expensive so for hot code it's a good idea to work with character codes instead.
As character codes make the code a lot more difficult to read and json3 is pure awesome from before, I only changed the most costly operations and kept the rest as before.
The performance is measured with node, I actually have no idea what the gain is on browsers that will use these functions. If anyone has access to proper VMs the changes can be benchmarked on http://jsperf.com/json3/20 (these are slightly more optimized as lex() only uses char codes)
Edit: Err, okay I'm new to pull requests, this did not go how it was supposed to go :D But I'm guessing you can figure it out @kitcambridge