Skip to content

Commit 062c982

Browse files
authored
Merge pull request #180 from keichi/hand-written
Add hand-written parser as a benchmark target
2 parents 9da9080 + 11667ae commit 062c982

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

benchmark/bench.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,17 @@ for (var i = 0; i < n; i++) {
6464

6565
// Run benchmarks
6666
suite
67+
.add("hand-written", function () {
68+
n = buf.readUInt32LE(0);
69+
const points = [];
70+
for (var i = 0; i < n; i++) {
71+
points.push({
72+
x: buf.readUInt16LE(i * 6 + 0 + 4),
73+
y: buf.readUInt16LE(i * 6 + 2 + 4),
74+
z: buf.readUInt16LE(i * 6 + 4 + 4),
75+
});
76+
}
77+
})
6778
.add("binparse", function () {
6879
const points = PointsParser.read(buf);
6980
})

0 commit comments

Comments
 (0)