Skip to content

Commit

Permalink
Split utf8 benchmarks into decode / encode
Browse files Browse the repository at this point in the history
  • Loading branch information
timostamm committed Oct 30, 2021
1 parent 0a5997e commit fbce12b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/benchmarks/bench-utf8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ for (let i = 3; i <= 14; i++) {

for (let fix of fixtures) {
console.log(`### ${fix.characters} characters`);
bench('@protobufjs/utf8 ', () => protobufJsDecode(protobufJsEncode(fix.text)));
bench('native ', () => nativeDecode(nativeEncode(fix.text)));
const bytes = nativeEncode(fix.text);
bench('decode @protobufjs/utf8 ', () => protobufJsDecode(bytes));
bench('decode native ', () => nativeDecode(bytes));
}
for (let fix of fixtures) {
console.log(`### ${fix.characters} characters`);
bench('encode @protobufjs/utf8 ', () => protobufJsEncode(fix.text));
bench('encode native ', () => nativeEncode(fix.text));
}

0 comments on commit fbce12b

Please sign in to comment.