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

Bind implementation is slower when native in modern browsers #7408

Closed
OEvgeny opened this issue Jan 8, 2018 · 1 comment
Closed

Bind implementation is slower when native in modern browsers #7408

OEvgeny opened this issue Jan 8, 2018 · 1 comment

Comments

@OEvgeny
Copy link

OEvgeny commented Jan 8, 2018

Version

2.5.13

Reproduction link

https://jsperf.com/vue-bind-perf

Steps to reproduce

Run tests across some modern browsers to see the result.

What is expected?

Custom bind implementation performance is the same level as native.

What is actually happening?

Custom bind implementation performance is lower than native.


Tested in:

  • Safari - native is slower 83%
  • Chrome - native is faster 61%
  • Edge - native is faster 91%
  • Firefox - native is faster 52%

I believe it is not an issue at all, but I think it is something which can be improved.

@HerringtonDarkholme
Copy link
Member

Thanks for the report!

JS engines didn't optimize fn.bind in past and we record that fact in comment. But JS engines are constantly evolving and our implementation is slower, haha.

Since Function.prototype.bind is more used in JS world, I believe JS engines will optimize the native usage more, like this. It seems better to use native one.

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

No branches or pull requests

3 participants