Skip to content

Commit

Permalink
Merge pull request #180 from keichi/hand-written
Browse files Browse the repository at this point in the history
Add hand-written parser as a benchmark target
  • Loading branch information
keichi authored Sep 27, 2021
2 parents 9da9080 + 11667ae commit 062c982
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions benchmark/bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ for (var i = 0; i < n; i++) {

// Run benchmarks
suite
.add("hand-written", function () {
n = buf.readUInt32LE(0);
const points = [];
for (var i = 0; i < n; i++) {
points.push({
x: buf.readUInt16LE(i * 6 + 0 + 4),
y: buf.readUInt16LE(i * 6 + 2 + 4),
z: buf.readUInt16LE(i * 6 + 4 + 4),
});
}
})
.add("binparse", function () {
const points = PointsParser.read(buf);
})
Expand Down

0 comments on commit 062c982

Please sign in to comment.