Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(air-parser)!: optimize Instruction type layout (#767)
Instead of being boxed for each node, the `Instruction` type contains a boxed variable-size elements. Thus `Instruction` is quite lean, and the allocator deals with variable-sized elements. Total number of allocations is more or less same, but less space is wasted for unused memory: previously the Instruction's size was 112 bytes in WASM, now it is 16. It reduces memory consumption on large AIR scripts (heap size decreased from 7.7MiB to 4.625MiB in parser-10000-100, and for the new parser-calls-10000-100 benchmark, it decreased from 5.115MiB to 4.375MiB). This is a breaking change as the API changes (though the code that navigates the parsed tree generally should work as is).
- Loading branch information