andrewkroh / elastic-ingest-wasm-go

Go library for executing Elastic WebAssembly ingest processors
0 stars 0 forks source link

Benchmark data #1

Open andrewkroh opened 2 years ago

andrewkroh commented 2 years ago

This is an issue to track the result of the benchmark during development. This is not a methodical approach.


From: c96d2ef764d3469f9de0eb456c395b3bcb48447a

% go test -bench . -benchtime 5s . -v     
=== RUN   TestProcess
--- PASS: TestProcess (0.03s)
goos: darwin
goarch: amd64
pkg: github.com/andrewkroh/elastic-ingest-wasm-go/pkg/webassembly
cpu: VirtualApple @ 2.50GHz
BenchmarkProcess
BenchmarkProcess/serial
BenchmarkProcess/serial-10                441374             13422 ns/op
BenchmarkProcess/parallel
BenchmarkProcess/parallel-10             1579858              3797 ns/op
PASS
ok      github.com/andrewkroh/elastic-ingest-wasm-go/pkg/webassembly    16.313s
andrewkroh commented 2 years ago

I hacked (e0cd94de4a4c75cae3a9e40cff3d3adb9eae3b85) together an implementation that uses wazero. The parallel track is not likely correct because it didn't not properly implement thread-safety into the hack.

goos: darwin
goarch: amd64
pkg: github.com/andrewkroh/elastic-ingest-wasm-go/pkg/webassembly
cpu: VirtualApple @ 2.50GHz
BenchmarkProcess
BenchmarkProcess/serial
BenchmarkProcess/serial-10                646933              8976 ns/op
BenchmarkProcess/parallel
BenchmarkProcess/parallel-10             2137299              2867 ns/op
PASS
ok      github.com/andrewkroh/elastic-ingest-wasm-go/pkg/webassembly    15.340s
andrewkroh commented 2 years ago

% benchcmp old.txt new.txt benchcmp is deprecated in favor of benchstat: https://pkg.go.dev/golang.org/x/perf/cmd/benchstat benchmark old ns/op new ns/op delta BenchmarkProcess/serial-10 13422 8976 -33.12% BenchmarkProcess/parallel-10 3797 2867 -24.49%