Consider rewriting to native ES6
mattkrick opened this issue · comments
The latest version of V8 can optimize functions that have let
and const
. This should provide some performance gain. Node 4.2+ takes it just fine, as does Chrome & Firefox nightly. Still waiting on Firefox & webkit to catch up.
Should you do this, I hope you consider adding an es5 compatibility build by transpiling with a tool like Babel!
no worries, I wouldn't do it until every browser natively supports all features. guys who dont ship compatible builds are jerks ;)
I'd love this, not only in the browser, but for supporting es6 imports during bundling with webpack/rollup. I'm only going to use a handful of these functions, so it'd be awesome to only import the ones I need. Not that 24k is huge... I just don't like bundling unused code for every dependency I include.
@jmeas that'd be awesome too! it's very easy to create multiple outputs with rollup. i have a project that creates an mjs output for the browser and a js output for node.
@micahscopes i'd be up for a PR but I don't have the bandwidth right now. To incorporate the modules, i'd suggest something like https://philipwalton.com/articles/deploying-es2015-code-in-production-today/ for a graceful fallback.
At the moment, I don't have time either, but I might in the next few months. I'll keep it in mind...