Skip to content

perf(statedb): avoid allocations in cache type comparison - #1045

Open
wangjingshuiku wants to merge 1 commit into
kaiachain:devfrom
wangjingshuiku:wangjingshuiku-maint-20260824
Open

perf(statedb): avoid allocations in cache type comparison#1045
wangjingshuiku wants to merge 1 commit into
kaiachain:devfrom
wangjingshuiku:wangjingshuiku-maint-20260824

Conversation

@wangjingshuiku

@wangjingshuiku wangjingshuiku commented Aug 24, 2026

Copy link
Copy Markdown

Proposed changes

Use strings.EqualFold when matching configured trie-node cache types instead of allocating lower-cased copies of both operands for every candidate. Accepted values and the canonical enum value returned by ToValid are unchanged.

Types of changes

  • 🐛 Bug fix
  • ✨ Non-hardfork changes (node upgrade not required)
  • 💥 Hardfork / consensus-breaking changes
  • 🧪 Test improvements
  • 🧰 CI / build tool
  • ♻️ Chore / Refactor / Non-functional changes

Checklist

  • 📖 I have read the CONTRIBUTING GUIDELINES document
  • 📝 I have signed the CLA statement if this is my first contribution
  • 🟢 Lint and unit tests pass locally with my changes (make test)

Targeted compilation check completed:
go test ./storage/statedb -run '^$'

Related issues

None.

Further comments

This is a non-functional allocation reduction in a small case-insensitive comparison loop.

Signed-off-by: wangjingshuiku <wangjingshuiku@163.com>
@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@wangjingshuiku

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@ian0371 ian0371 added the do not merge Do not merge just yet label Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge Do not merge just yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants