Skip to content

Commit

Permalink
Removed extremely slow Array.prototype.slice from hot path
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina committed Oct 5, 2016
1 parent 20f1dc5 commit 821eb96
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ function Wayfarer (dft) {
// (str, obj?) -> null
function emit (route) {
assert.notEqual(route, undefined, "'route' must be defined")
const args = Array.prototype.slice.apply(arguments)
const args = new Array(arguments.length)
for (var i = 1; i < args.length; i++) {
args[i] = arguments[i]
}

const node = _trie.match(route)
if (node && node.cb) {
Expand Down

0 comments on commit 821eb96

Please sign in to comment.