- From: Ruben Verborgh <ruben.verborgh@ugent.be>
- Date: Wed, 6 Nov 2013 13:07:38 +0000
- To: Austin William Wright <aaa@bzfx.net>
- Cc: "public-rdfjs@w3.org" <public-rdfjs@w3.org>
Hi Austin, > In benchmarking most versions of V8, objects created with `new`, as opposed to a key/value map with fixed keys, are created faster. I don't know about strings or other primitives, though. Your tests suggest: strings > instances (with specified keys) > maps (with arbitrary keys). The latest Chrome tells me differently: maps are faster [1] and this makes sense if you consider that a “new” operation has to do two additional steps (set the constructor and prototype). > That's a good idea. I'd suggest writing a few different classes of tests, and implementing them different ways. The tests should be separate fields, maybe like '1a', '1b', etc, describing the example to be written and the implementation, respectively. Got something in place now with identifiers. (gt1 and gt2 for Generating Triples with algorithm 1 and 2) > Well, how valuable should performance be? If it was of the utmost priority, we could just use ASM. Well, the boundary condition is “JavaScript”, so we can’t change that. Bit within JavaScript, we can be optimal. > it's not always the case that technically faster code is easier to use while being fast. Certainly not; often the exact opposite. > I probably am to end up doing something esoteric to enable fast inserts in my triple index, since ECMAScript doesn't have decent builtin data structures. I expect a lot from the upcoming Maps. But when these will land is another question… Cheers, Ruben [1] http://jsperf.com/string-vs-new-vs-object
Received on Wednesday, 6 November 2013 13:08:15 UTC