3 ms·
Native ES6 is faster in WebKit than polyfill/transpiled.
by pizlonator 9y ago
Native ES6 is faster in WebKit than polyfill/transpiled.
- jacobolus 9y agoYes, but sticking to old-school Javascript features was dramatically faster than either.
- pizlonator 9y agoNot 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.
- netheril96 9y agoBut 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 {}.
- pizlonator 9y agoI'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.
- saamyjoon 9y agoI agree too. I wonder if this has been discussed at TC39.
- fenomas 9y agoTo 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)
- pizlonator 9y agoNo, I don't mean that. If you're using string or integer keys, then I think that {} still have a perf advantage.