Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbol.split polyfill poor performance #451

Open
paatrofimov opened this issue Nov 22, 2018 · 1 comment
Open

Symbol.split polyfill poor performance #451

paatrofimov opened this issue Nov 22, 2018 · 1 comment

Comments

@paatrofimov
Copy link

Steps I took to to reproduce issue:

  1. npm init react-app my-app
  2. npm i es6-shim --save
  3. npm start
  4. open console (chrome), run script from below and inspect printed result (~7)
  5. add require('es6-shim') to index.js (devserver updates)
  6. repeat step 4 and inspect another result (~105)
var test = Array.from({length: 100000}, () => 'a').join('.');
var start = new Date();
test.split(/\./)
console.log(new Date() - start);

Why is es6-shim Symbol.split implementation significantly slower than native implementation? Is it a bug or intented behaviour?
Also I don't understand, why Symbol.split gets polyfilled though chrome supports its implementation.

Thank you for response in advance.

@ljharb
Copy link
Collaborator

ljharb commented Nov 22, 2018

Native implementations are always faster than polyfilled ones, that’s unavoidable.

As far as why it gets polyfilled on chrome, you can load the native tests file to see what related tests are failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants