-
Notifications
You must be signed in to change notification settings - Fork 42
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
Poor use of memory / too many allocations in HashLeaf
, leading to GC to work in overdrive
#216
Comments
If the same allocation is reused in HashLeaf--would that make it not threadsafe? If so, should be considered, I believe trees are often computed in parallel. |
HashLeaf
, leading to GC to work in overdrive
I would try the folllwing fwiw. Change these appends Lines 190 to 192 in 564300a
to minMaxNIDs := append(append(make([]byte, 0, resLen), nID...), nID...) and see if that removes the need for additional allocs. Similar for the other appends: Lines 195 to 197 in 564300a
|
Also, it is important to use benchstat for any related changes (since we disabled go-bencher recently): https://pkg.go.dev/golang.org/x/perf/cmd/benchstat Should include both mem and CPU. |
This could be somewhat related: #212 |
More time is spent in HashLeaf allocating, than hashing:
https://github.com/celestiaorg/nmt/blob/master/hasher.go#L190
https://flamegraph.com/share/a54e891a-1114-11ee-b13f-de9431916b05
Possibly related:
In celestia-node, min and max namespace take up 200MB (20%) of RAM
The text was updated successfully, but these errors were encountered: