Skip to content

Commit

Permalink
Fix benchmark when feature is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
RReverser committed Dec 29, 2022
1 parent 869a23e commit d3f5e34
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions benchmarks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ for (let input of ['canada', 'citm_catalog', 'twitter']) {

for (const lib of ['serde_json', 'serde_wasm_bindgen', 'msgpack']) {
const parse = benches[`parse_${input}_with_${lib}`];
suites.parse.add(`${input} x ${lib}`, () => parse(json).free());
if (parse) {
suites.parse.add(`${input} x ${lib}`, () => parse(json).free());
}

const serialize = benches[`serialize_${input}_with_${lib}`];
let parsed = parse(json);
suites.serialize.add(`${input} x ${lib}`, () => serialize(parsed), {
onComplete: () => parsed.free()
});
if (serialize) {
let parsed = parse(json);
suites.serialize.add(`${input} x ${lib}`, () => serialize(parsed), {
onComplete: () => parsed.free()
});
}
}
}

Expand Down

0 comments on commit d3f5e34

Please sign in to comment.