Re:JSC loves ES6
by jacobolus on Monday June 05, 2017 @08:37PM
(#14493735)
Yes, but sticking to old-school Javascript features was dramatically faster than either.
[ Parent
| on HN ]
Re:JSC loves ES6
by pizlonator on Monday June 05, 2017 @08:55PM
(#14493846)
Not necessarily. Map/Set is a counterexample. There’s no substitute for the JIT knowing how to reason about the internal aliasing properties of your hash table implementation.
We’ll keep working on more optimizations for ES-6 so there will be more counter examples.
To be clear, do you mean that Map/Set is faster than {} even for plain idiomatic hashes with string keys (as opposed to pathological cases)?
When I last tested in other JS engines I found plain {} hashes were still moderately faster. (Haven't tried Safari since it doesn't support what I've been working on)
Re:JSC loves ES6
by pizlonator on Monday June 05, 2017 @11:09PM
(#14494425)
No, I don't mean that. If you're using string or integer keys, then I think that {} still have a perf advantage.
Re:JSC loves ES6
by netheril96 on Monday June 05, 2017 @10:46PM
(#14494316)
But ES6 Map/Set is almost useless as it has no custom hash nor equality function. The key is either numeric, string, or object identity, not anyway better than the builtin {}.
Re:JSC loves ES6
by pizlonator on Monday June 05, 2017 @11:10PM
(#14494435)
I've found them to be useful when I write ES6 code. I agree that custom hash and equality functions would make these classes a lot better.