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

Already on GitHub? Sign in to your account

optimize usage of fn.apply #260

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants

hnry commented Mar 6, 2013

Optimize the usage of fn.apply, by using fn.call whenever possible results in at least 100% performance increase over just using fn.apply.

The benchmark is here:
http://jsperf.com/callorapply-vs-apply

The performance increase is twice as fast on Chrome. And ridiculously faster on Firefox (looks like 700% increase).

It is just microseconds after all. But shaving microseconds off a latency sensitive operations matters. And the savings adds up over time. Also considering async's job relies heavily on calling functions it should see real benefits.

It doesn't add any real bulk or complexity to existing code, the only downside is, it adds a few bytes (browser only).

Doesn't break current tests, all tests passing without modification.

Owner

caolan commented Mar 28, 2014

This really shouldn't be a performance concern when compared to the of calling async functions

@caolan caolan closed this Mar 28, 2014

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