Closed debuggingfuture closed 10 years ago
Since it's a shim, performance isn't the goal, compliance is. That said, if you find a particular part of the Map shim to be slow, we'd love to optimize it.
Maps and Sets in the shim have both a fast and a slow path - basically, the "fast path" is for non-objects. Your test case doesn't include objects, so it only hits the fast path - and if you're not using objects, you might as well just use a normal {}
:-)
Also, the "native array" test is irrelevant - you should be comparing to something like Object.keys(map).forEach(function (key) { map[key] })
instead.
it is ineresting, that Map.prototype.forEach in es6-shim is faster than native in FF 28 and Chrome 26, and slower in IE 11 only
To reiterate, we'll be happy to look at performance-oriented PRs - however, "non-optimal performance" isn't an issue for this shim, so I'm closing this.
what is the most optimal way in terms of performance to loop the Map in es6 shim? I am trying to use .forEach http://jsperf.com/es6-shim
it seems it has larger penalty of index vs reference traversal than usual, probably as data did not benefit from array locality? http://jsperf.com/javascript-graph/2