Fix cross-browser object enumeration issues#385
Conversation
|
👍 |
|
+1 |
|
I'd love to see the JSPerf.com tests, comparing this for some simple iterations of thousand-length arrays and objects. |
|
The perf impact seems to be minimal either fluctuating between being equal or the pull request 385 being ~5-9 percent slower from refresh to refresh. The wiggle room for each testing being marked indistinguishable is ~5.5 percent so things are very close and in IE6 it seems the pull request iteration is actually faster despite the extra checks (because of other optimizations). This patch addresses enumeration issues in IE < 9, Safari < 5.1 and Opera < 12. |
|
Merged -- if you'd like to tweak some of these additions to read more clearly, feel free. Otherwise I may take a stab at it later. |
|
K, I will do a little cleanup when I add the unit tests in a pull request this evening. |
|
Probably. |
|
Now that all the commits have been ironed out the perf of edge is faster or equal to v1.2.2 :D |
|
That's rad. |
|
The above commit rolls back the changes introduced in this ticket. With all due apologies for temporarily having them on master -- after further discussion, implementing such significant code branches to solve a problem that's so rarely encountered in real-world code isn't a direction that Underscore should take. |
Fix cross-browser object enumeration issues.
This patch should address the concerns brought up by @jashkenas in issue #376.
The gzipped filesize diff is around ~0.23 kb and the speed concerns have been addressed (will add perf tests asap) by optimizing other areas of underscore.js.
As I mentioned in the original issue several-libs-attempt to tackle this issue and recently @kangax tweeted:
Currently it passes the existing unit tests (one throttle unit test fails in IE6, but it does on the official release too).
If this patch gets the green light I will commit unit tests and further patches/pull-requests to speed up underscore.js methods by up to 50%.