Skip to content

Commit

Permalink
buffer: fix dataview-set benchmark
Browse files Browse the repository at this point in the history
Improves numbers up to 4x by avoiding repetitive dynamic method lookup.

PR-URL: #6922
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
  • Loading branch information
RReverser authored and Myles Borins committed Jul 12, 2016
1 parent 27222f4 commit 957505a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions benchmark/buffers/dataview-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,20 @@ function main(conf) {
}

function benchInt(dv, fn, len, le) {
var m = mod[fn];
const m = mod[fn];
const method = dv[fn];
bench.start();
for (var i = 0; i < len; i++) {
dv[fn](0, i % m, le);
method.call(dv, 0, i % m, le);
}
bench.end(len / 1e6);
}

function benchFloat(dv, fn, len, le) {
const method = dv[fn];
bench.start();
for (var i = 0; i < len; i++) {
dv[fn](0, i * 0.1, le);
method.call(dv, 0, i * 0.1, le);
}
bench.end(len / 1e6);
}

0 comments on commit 957505a

Please sign in to comment.