Skip to content

Commit

Permalink
events: onceWrapper apply directly with arguments
Browse files Browse the repository at this point in the history
Due to changes in V8 in 6.0 & 6.1, it's no longer necessary to copy
arguments to avoid deopt. Just call .apply with arguments. Retains
fast cases for 0-3 arguments.

events/ee-once-4-args.js n=20000000     11.58 %      *** 1.310379e-05
  • Loading branch information
apapirovski committed Oct 15, 2017
1 parent 40a7e23 commit 0585047
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,7 @@ function onceWrapper() {
return this.listener.call(this.target, arguments[0], arguments[1],
arguments[2]);
default:
const args = new Array(arguments.length);
for (var i = 0; i < args.length; ++i)
args[i] = arguments[i];
this.listener.apply(this.target, args);
this.listener.apply(this.target, arguments);
}
}
}
Expand Down

0 comments on commit 0585047

Please sign in to comment.