We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b99ae40 commit 215959fCopy full SHA for 215959f
benchmark/bench.js
@@ -64,13 +64,14 @@ for (let i = 0; i < n; i++) {
64
// Run benchmarks
65
suite
66
.add("hand-written", function () {
67
- const n = buf.readUInt32LE(0);
+ const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
68
+ const n = view.getUint32(0, true);
69
const points = [];
70
for (let i = 0; i < n; i++) {
71
points.push({
- x: buf.readUInt16LE(i * 6 + 0 + 4),
72
- y: buf.readUInt16LE(i * 6 + 2 + 4),
73
- z: buf.readUInt16LE(i * 6 + 4 + 4),
+ x: view.getUint16(i * 6 + 0 + 4, true),
+ y: view.getUint16(i * 6 + 2 + 4, true),
74
+ z: view.getUint16(i * 6 + 4 + 4, true),
75
});
76
}
77
})
0 commit comments