You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed wasm_loader_get_const_offset appearing in some of our benchmarks for module loading. This function does a linear search of the currently known constants to generate an offset in the constant table. If none is found, a new constant is added.
If I'm not mistaken, this ends up doing a linear search for every i32.const, i64.const, etc. If there are n such instructions, this becomes O(n^2) in module loading.
What if the loader maintained a hashmap of const -> offset alongside the constant table? This would allow testing presence of constants to be done much more quickly, at the expense of some memory.
What do you think?
The text was updated successfully, but these errors were encountered:
Hi all,
I've noticed
wasm_loader_get_const_offset
appearing in some of our benchmarks for module loading. This function does a linear search of the currently known constants to generate an offset in the constant table. If none is found, a new constant is added.If I'm not mistaken, this ends up doing a linear search for every
i32.const
,i64.const
, etc. If there aren
such instructions, this becomesO(n^2)
in module loading.What if the loader maintained a hashmap of const -> offset alongside the constant table? This would allow testing presence of constants to be done much more quickly, at the expense of some memory.
What do you think?
The text was updated successfully, but these errors were encountered: