Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A faster Node.js alternative to [].slice.call(arguments)
JavaScript
tree: 50df0d621f

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
History.md
Makefile
README.md
bench.js
index.js
package.json

README.md

sliced

A faster alternative to [].slice.call(arguments).

Build Status

Example output from benchmark.js

Array.prototype.slice.call x 1,289,592 ops/sec ±2.88% (87 runs sampled)
[].slice.call x 1,345,451 ops/sec ±1.68% (97 runs sampled)
cached slice.call x 10,719,886 ops/sec ±1.04% (99 runs sampled)
sliced x 15,809,545 ops/sec ±1.46% (93 runs sampled)
fastest is sliced

Benchmark source.

Usage

sliced accepts the same arguments as Array#slice so you can easily swap it out.

function zing () {
  var slow = [].slice.call(arguments, 1, 8);
  var args = slice(arguments, 1, 8);

  var slow = Array.prototype.slice.call(arguments);
  var args = slice(arguments);
  // etc
}

install

npm install sliced

LICENSE

Something went wrong with that request. Please try again.