Skip to content

Commit

Permalink
chore: bench output
Browse files Browse the repository at this point in the history
  • Loading branch information
cha0s committed Nov 25, 2024
1 parent 9637235 commit 1408f50
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ else {
for (let i = 0; i < N; ++i) {
schemaPackPerson.encode(value);
}
console.log('SchemaPack\t', performance.now() - schemaPackEncodeStart);
console.log('SchemaPack\t', (performance.now() - schemaPackEncodeStart).toFixed(2), 'ms');

const crunchesPerson = new Schema(blueprint);
value.opaque = opaque.buffer;
const crunchesView = new DataView(new ArrayBuffer(crunchesPerson.size(value)));
for (let i = 0; i < N; ++i) {
crunchesPerson.encode(value, crunchesView);
crunchesPerson.encode(value, crunchesView, 0);
}
const crunchesEncodeStart = performance.now();
for (let i = 0; i < N; ++i) {
crunchesPerson.encode(value, crunchesView);
crunchesPerson.encode(value, crunchesView, 0);
}
console.log('crunches\t', performance.now() - crunchesEncodeStart);
console.log('crunches\t', (performance.now() - crunchesEncodeStart).toFixed(2), 'ms');

console.groupEnd();

Expand All @@ -86,16 +86,16 @@ else {
for (let i = 0; i < N; ++i) {
schemaPackPerson.decode(schemaPackBuffer);
}
console.log('SchemaPack\t', performance.now() - schemaPackDecodeStart);
console.log('SchemaPack\t', (performance.now() - schemaPackDecodeStart).toFixed(2), 'ms');

for (let i = 0; i < N; ++i) {
crunchesPerson.decode(crunchesView);
crunchesPerson.decode(crunchesView, {byteOffset: 0});
}
const crunchesDecodeStart = performance.now();
for (let i = 0; i < N; ++i) {
crunchesPerson.decode(crunchesView);
crunchesPerson.decode(crunchesView, {byteOffset: 0});
}
console.log('crunches\t', performance.now() - crunchesDecodeStart);
console.log('crunches\t', (performance.now() - crunchesDecodeStart).toFixed(2), 'ms');

console.groupEnd();

Expand Down

0 comments on commit 1408f50

Please sign in to comment.