fast-apply
Apply an array of arguments... faster
Last updated 13 years ago by jaycetde .
MIT · Repository · Original npm · Tarball · package.json
$ npm install fast-apply 
SYNC missed versions from official npm registry.

fast-apply

Apply an array of arguments... faster.


var fastApply = require('fast-apply')
  , scope = {}
;

function run() {}

fastApply(run, scope, [ 'a', 'b', 'c' ]);

Installation

$ npm install fast-apply

Dependencies

none

Speed

It uses a simple switch statement to call the function rather than apply for up to 5 arguments.

While more than 5 arguments would run faster using apply, anything less will be up to twice as fast

If the scope is null, fastApply will run up to 3 times faster than apply

Limitations

  • It is only optimized for 5 arguments or less. If you think the function will frequently be taking more than 5 arguments, I suggest that you instead use apply

Current Tags

  • 0.0.3                                ...           latest (13 years ago)

4 Versions

  • 0.0.3                                ...           13 years ago
  • 0.0.2                                ...           13 years ago
  • 0.0.1                                ...           13 years ago
  • 0.0.0                                ...           13 years ago
Maintainers (1)
Downloads
Total 11
Today 1
This Week 2
This Month 7
Last Day 1
Last Week 5
Last Month 4
Dependencies (0)
None
Dev Dependencies (1)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE