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.
This PR implements sync.Pool optimization for []common.Hash slice allocations in PathDB lookup functionality, addressing the TODO comments in
triedb/pathdb/lookup.go
.Implemented a sync.Pool for
[]common.Hash
slices following the established patterns used in other parts of the codebase (e.g.,core/types/hashing.go
,core/vm/memory.go
):The implementation follows the same sync.Pool patterns used throughout the go-ethereum codebase
Deliberately chose not to implement
Put()
operations to avoid potential data corruption since the slices are stored in maps and shared across goroutinesThe approach prevents race conditions that could occur if slices were returned to the pool while still being referenced in the lookup maps
-
go test ./triedb/pathdb/
- 67 tests passed-
go test ./triedb/...
- All triedb packages tested-
go test ./core/state/
- StateDB compatibility confirmed