03.10.2013, 02:30, "Gagle" <[email protected]>:
El miércoles, 2 de octubre de 2013 23:20:29 UTC+2, Alex Kocharin escribió:
But it doesn't seem to be happening soon.


Never. Extremly slow compared with native json parser.
 
It doesn't make any sense to compare native json parser with userland parser. Of course last one will be slower. As for "extremely slow", I love it when people tell that something like that without actually running all the benchmarks.
 
Anyway, speed doesn't matter here. Usual size for package.json file is about 1kb, and that's how fast it is parsed:
 
JSON-native      6.9195075 µs   // v8 native stuff
JSON-js         57.7448887 µs   // Crockford's reference parser
JSON-js-state   76.5400478 µs   // Crockford's reference FSM
JS-YAML         62.3995833 µs   // js-yaml npm module
JSON5           61.0992242 µs   // current JSON5 module
 
100 packages will be parsed under 10 milliseconds, and I highly doubt any package you'll deal with will have more dependencies than that. But even if you will, node.js will spend far more time reading file from hdd than parsing it anyway. Why do you even think about performance here?
 
 
Out of the interest, I also tested 500kb json file because I think it shows real performance better.
 
JSON-native      5.7313025 ms    // v8 native stuff
JSON-js         32.7220672 ms    // Crockford's reference parser
JSON-js-state   28.9030499 ms    // Crockford's reference FSM
JS-YAML         22.2169591 ms    // js-yaml npm module
JSON5           44.5108157 ms    // current JSON5 module
Well, it is slow all right, and it's kinda expected from an experimental module. But it's not *extremely* slow, and it is just 2 times slower than it could be, hardly a big deal at all.
 
By the way, I'm very surprised about js-yaml outperforming json-js on a big data chunk, that's yaml parser that parses json works better than json parser. Good work, huh.
 
Test file used here: http://pastebin.com/yHewdcDg
 
 
I also agree with the OP. The json format is being misused massively by the people. JSON is a transport protocol, it was never intended to be used as a storage format. Double quotes, no comments, impossible to maintain by humans.

 

--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
 
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
 
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to