wasmerio / wasmer-php

🐘🕸️ WebAssembly runtime for PHP
https://wasmerio.github.io/wasmer-php/wasm/
MIT License
1.01k stars 42 forks source link

test(benchmarks) Add the `InvokeFunction` benchmark #56

Closed Hywan closed 5 years ago

Hywan commented 5 years ago

This benchmark aims at showing the improvement made in https://github.com/wasmerio/php-ext-wasm/pull/54.

Before #54:

subject mem_peak mean mode best
bench_invoke_sum 1,437,376b 10.450μs 10.350μs 10.237μs
bench_invoke_i32_i64_f32_f64_f64 1,437,376b 11.204μs 11.076μs 10.922μs

After:

subject mem_peak mean mode best
bench_invoke_sum 1,421,560b 9.431μs 9.384μs 9.297μs
bench_invoke_i32_i64_f32_f64_f64 1,421,560b 9.419μs 9.399μs 9.342μs

We can observe that invoking an exported function is between 9.8% to 15.9% faster. Memory usage is also 1% smaller, bonus.