polkadot-spec
polkadot-spec copied to clipboard
Benchmark the effect of calling ext native functions in wasm blobs written in rust
We need to make a wasm blob which repeat an operation in a function inside the wasm and 2. calling out side the blob and compare the timing this is related to 425 research-internal issue.
Cloning https://github.com/wasmerio/wasmer-rust-example and adding stuff to it.
added command line arg and empty add_inside_wasm and add_outside_wasm. In wasm added simple function to add some value to a variable
failed to add some randomness to wasm (to protect against optimization) apparently rng in wasm is a mess. added a function to compute Fibonacci numbers but it overflow the u64 so I need to replace it with bigint.
- add big num to make fibo benachi numbers computed in wasm and test everything.
- move the addition function to the an internal wasm function.
- move the addition function to an external addition function.
I had lots of trouble passing bigint from wasm to the ext function because wasmer doesn't have a good support to this without copying for object which do not implement copy. Then I realized that in substrate we only deal with wasmi and wasmtime and their performance might be/is different than wasmer so I'm going to change the runtime executor to either of those and refactor the code.
@drskalman has higher priority issues for now. On hold.