Conversation
lxq015
force-pushed
the
euler_HashTrieMap
branch
from
September 3, 2026 07:29
3d6e94e to
99377f5
Compare
lxq015
requested review from
BoyaoWang430,
ctk-1998,
newborn22,
wangpc-pp and
wenchangping
September 3, 2026 07:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://gitcode.com/openeuler/golang/pull/51
This CL adds a "wide trie" implementation of
internal/sync.HashTrieMap(themap backing
sync.Map), which raises the branching factor of internal nodesfrom 16 (4 bits per level) to 128 (7 bits per level). This reduces the maximum
tree depth from 16 to ~10 levels, cutting the number of dependent atomic loads
and pointer dereferences on every lookup/update path. It also fixes an edge
case when expanding entries whose hashes collide down to the final hash level,
covered by new regression tests.
Usage: build with
GOEXPERIMENT=widetriegoos: linux
goarch: riscv64
pkg: internal/sync
cpu: Spacemit(R) X60
│ before.txt │ after.txt │
│ sec/op │ sec/op vs base │
HashTrieMapLoadSmall 87.70n ± 6% 81.36n ± 4% -7.23% (p=0.002 n=6)
HashTrieMapLoad 109.7n ± 1% 109.7n ± 1% ~ (p=1.000 n=6)
HashTrieMapLoadLarge 1610.0n ± 1% 966.6n ± 1% -39.96% (p=0.002 n=6)
HashTrieMapLoadOrStore 111.6n ± 1% 114.4n ± 2% +2.51% (p=0.009 n=6)
HashTrieMapLoadOrStoreLarge 1.969µ ± 18% 1.731µ ± 10% ~ (p=0.065 n=6)
geomean 320.9n 279.5n -12.88%