wasm2map icon indicating copy to clipboard operation
wasm2map copied to clipboard

Use a stack-based vec type instead of String in building the VLQ encoded bits

Open mtolmacs opened this issue 1 year ago • 1 comments

Background

There is a tight loop within WASM::generate where mappings are built and VQL encoded, which currently uses String. However String is heap allocated, which means a ton of small allocations. Since there is a practical limit of how long the mappings usually are, we can use a stack-based vec type (arrayvec, tinyvec, smallvec or the like) to avoid these allocations completely.

Success

Expected at least 50% mapping speedup based on previous experiments with heap vs stack allocated vec types.

mtolmacs avatar Apr 19 '23 10:04 mtolmacs