celestiaorg / celestiaorg/nmt

Poor use of memory / too many allocations in `HashLeaf`, leading to GC to work in overdrive

Open
#216 7 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
122
Forks
53
Avg merge
1d 15h
Merged PRs (30d)
5

Description

More time is spent in HashLeaf allocating, than hashing:

![image](https://github.com/celestiaorg/nmt/assets/5038597/635db6be-414f-409f-b63b-92018da2d307)
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

![image](https://github.com/celestiaorg/nmt/assets/5038597/dd730b0e-7231-4d77-9ffb-bb1cf5184daf)

Contributor guide

Open the contributing guide

Research direction

Start in hasher.go around line 190 and use the linked flamegraph to inspect why HashLeaf spends more time allocating than hashing. Profile the related namespace min/max memory behavior described in the issue, then verify that HashLeaf allocations and GC pressure are materially reduced.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cryptography, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.