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
Currently when executing wasmi bytecode there is the so-called InstanceCache which caches data frequently used during wasmi bytecode execution such as the default Memory bytes.
Whenever calling a function that originates from a different Instance this InstanceCache and all of its cached data is reset.
These default Memory bytes are loaded upon their first use after such an InstanceCache reset. The upside is that default Memory query is not done if no instructions interacting with the default Memory are executed. The downside is that this incurs a minor dispatch for every such instruction.
The idea behind this issue is to pre-load the default Memory bytes upon resetting the InstanceCache and when there is no default Memory to simply use a static [] as placeholder default memory bytes.
The downside of this approach is that resetting the InstanceCache becomes slightly more expensive, however, instructions interacting with the default Memory become a bit cheaper.
A wasmi execution that calls a lot of functions imported from different Wasm module instances or one that successfully grows the default Memory often (which is unlikely) might regress in their performance, whereas a wasmi execution that has a lot of Memory instructions such as i32.load, f64.store, etc. should see a performance improvement.
Further benchmarks are going to be needed once this has been implemented.
Implement pre-loading of the default Memory bytes as described above.
Conduct benchmarks and explain the results.
If needed: Maybe introduce new benchmarks that properly show the performance improvements.
The text was updated successfully, but these errors were encountered:
Currently when executing
wasmi
bytecode there is the so-calledInstanceCache
which caches data frequently used duringwasmi
bytecode execution such as the defaultMemory
bytes.Whenever calling a function that originates from a different
Instance
thisInstanceCache
and all of its cached data is reset.These default
Memory
bytes are loaded upon their first use after such anInstanceCache
reset. The upside is that defaultMemory
query is not done if no instructions interacting with the defaultMemory
are executed. The downside is that this incurs a minor dispatch for every such instruction.The idea behind this issue is to pre-load the default
Memory
bytes upon resetting theInstanceCache
and when there is no defaultMemory
to simply use a static[]
as placeholder default memory bytes.The downside of this approach is that resetting the
InstanceCache
becomes slightly more expensive, however, instructions interacting with the defaultMemory
become a bit cheaper.A
wasmi
execution that calls a lot of functions imported from different Wasm module instances or one that successfully grows the defaultMemory
often (which is unlikely) might regress in their performance, whereas awasmi
execution that has a lot ofMemory
instructions such asi32.load
,f64.store
, etc. should see a performance improvement.Further benchmarks are going to be needed once this has been implemented.
Memory
bytes as described above.The text was updated successfully, but these errors were encountered: