Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow compared to map? #39

Open
kokizzu opened this issue Mar 31, 2023 · 2 comments
Open

Slow compared to map? #39

kokizzu opened this issue Mar 31, 2023 · 2 comments

Comments

@kokizzu
Copy link

kokizzu commented Mar 31, 2023

Hi, i was trying to benchmark haxmap vs map,

https://github.com/kokizzu/kokizzu-benchmark/blob/master/assoc/go-haxmap/haxmap.go
vs
https://github.com/kokizzu/kokizzu-benchmark/blob/master/assoc/map.go
the diff
https://pastebin.com/diff/V3Y04Uha

but haxmap took like 51s vs 14s using map

time go run go-haxmap/haxmap.go                                                                                                                    
6009354 6009348 611297
36186112 159701682 23370001

CPU: 51.86s     Real: 26.87s    RAM: 2 386 608KB

time go run map.go 
6009354 6009348 611297
36186112 159701682 23370001

CPU: 14.29s     Real: 12.43s    RAM: 2 271 672KB
@someview
Copy link

the scenario is different. go standard map is not concurrent map. Now the haxmap use lock free list to ensure that the map is concurrently safe,different from shard map with rwlock(this is waitfree lock)

@Verseth
Copy link

Verseth commented Nov 7, 2024

A more fair comparison would be to a map with a Mutex/RWMutex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants