polkadot-spec icon indicating copy to clipboard operation
polkadot-spec copied to clipboard

Benchmark the effect of calling ext native functions in wasm blobs written in rust

Open drskalman opened this issue 5 years ago • 6 comments

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.

drskalman avatar Jul 23 '20 12:07 drskalman

Cloning https://github.com/wasmerio/wasmer-rust-example and adding stuff to it.

drskalman avatar Jul 23 '20 18:07 drskalman

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

drskalman avatar Jul 23 '20 18:07 drskalman

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.

drskalman avatar Jul 27 '20 22:07 drskalman

  • 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 avatar Jul 30 '20 21:07 drskalman

@drskalman has higher priority issues for now. On hold.

lamafab avatar Nov 04 '20 16:11 lamafab