Skip to content

Conversation

@eatmoreapple
Copy link
Collaborator

…llocation

  • Replace strings.Split() with character-by-character iteration in Get method
  • Apply same optimization to Insert, GetByPrefix, and Delete methods
  • Eliminate unnecessary slice allocation when traversing key parts
  • Improve performance by ~38% for Get operations (75.06ns → 46.59ns)
  • Reduce GC pressure by avoiding intermediate slice allocations
  • Maintain full API compatibility and functionality

…llocation

- Replace strings.Split() with character-by-character iteration in Get method
- Apply same optimization to Insert, GetByPrefix, and Delete methods
- Eliminate unnecessary slice allocation when traversing key parts
- Improve performance by ~38% for Get operations (75.06ns → 46.59ns)
- Reduce GC pressure by avoiding intermediate slice allocations
- Maintain full API compatibility and functionality
@eatmoreapple eatmoreapple merged commit 6804ae7 into main Jan 12, 2026
2 checks passed
@eatmoreapple eatmoreapple deleted the perf/trie-get-method-optimization branch January 12, 2026 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants