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 <[email protected]>
Reviewed-By: Trevor Norris <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Brian White <[email protected]>
  • Loading branch information
RReverser authored and Myles Borins committed Jul 14, 2016
1 parent 20d3378 commit 7dbb0d0
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 7dbb0d0

Please sign in to comment.