CosmWasm / wasmvm

Go bindings to the CosmWasm VM
Apache License 2.0
173 stars 98 forks source link

Try sync.Map v2 #502

Closed webmaster128 closed 8 months ago

webmaster128 commented 8 months ago

A re-created version of https://github.com/CosmWasm/wasmvm/commit/d7829b96f9db7b130f21d9795c45cdc6d72a5bc1 for #322.

This seems to work overall, but I am not impressed by the timing imporvements this brings:

Before (without sync.Map)

BenchmarkConcurrentIterators-10             1000          17665542 ns/op
BenchmarkConcurrentIterators-10             1000          17598419 ns/op
BenchmarkConcurrentIterators-10             1000          17232989 ns/op
BenchmarkConcurrentIterators-10             1000          17355900 ns/op

After (with sync.Map)

BenchmarkConcurrentIterators-10             1000          16104471 ns/op
BenchmarkConcurrentIterators-10             1000          16180791 ns/op

Maybe some more realistic use case is needed to better evaluate performance but those ~7% in this aggressively paralized test on 10 cores is not really convincing me.