VM instantiation spends a third of its time defining host functions in the linker -- these are fairly atomics-heavy operations due to threadsafety in wasmi -- and this can be minimized if we filter for the host functions that a contract actually uses.
The caveat here is that in the worst case a contract could still use all host functions, so from a metering perspective we would probably have to make the instantiation costs more granular (eg. introduce a new cost type LinkVMFunction with a linear model based on the number used, or something).
VM instantiation spends a third of its time defining host functions in the linker -- these are fairly atomics-heavy operations due to threadsafety in wasmi -- and this can be minimized if we filter for the host functions that a contract actually uses.
The caveat here is that in the worst case a contract could still use all host functions, so from a metering perspective we would probably have to make the instantiation costs more granular (eg. introduce a new cost type
LinkVMFunction
with a linear model based on the number used, or something).