gh123man / cgo-rust-perf-test

2 stars 1 forks source link

Wasm #3

Closed scottopell closed 1 year ago

scottopell commented 1 year ago

Examples of running noop (string copy), regex, and VRL all compiled from rust to wasm32-wasi.

To build: ./build.sh

Execution Environment Scenario Result
Go String Copy 4.0 GB / second
Rust (FFI) String Copy 1.6 GB / second
Rust (WASM Wazero) String Copy 436 MB / second
Rust (WASM Wasmtime) String Copy 213 MB / second
Go Regex Substitution 50 MB / second
Rust (FFI) Regex Substitution 1.0 GB / second
Rust (WASM Wazero) Regex Substitution 276 MB / second
Rust (WASM Wasmtime) Regex Substitution 180 MB / second
Rust (FFI) VRL Replace 400 MB / second
Rust (WASM Wazero) VRL Replace 72 MB / second
Rust (WASM Wasmtime) VRL Replace 112 MB / second
scottopell commented 1 year ago

Wasm updates! See main comment.

tl;dr - wazero is faster, no-op string-copy can reach 265 MB / s (!!). Still no vrl :(

jonathanpv commented 1 year ago

Wasm updates! See main comment.

tl;dr - wazero is faster, no-op string-copy can reach 265 MB / s (!!). Still no vrl :(

I ran into issues running vrl with wasmtime as well, found it was due to interface types/component models not being implemented yet. I was hoping your write-to-memory-read-in-go solution would work but seems like it isn't at the moment?

I wrote an internal doc in confluence outlining my findings but the use-case I have is different than this. I'll slack the link and perhaps it might help out with this effort.

edit: typos edit2: seems like it seems fine to share the url here https://datadoghq.atlassian.net/l/cp/06MvkTbr

scottopell commented 1 year ago

Out of draft, latest updates in the comment, but should be ready to merge in.