Skip to content

Conversation

@jakebailey
Copy link
Member

Closes #1640

This turns out to be a top allocator in tests too.

@Copilot Copilot AI review requested due to automatic review settings October 4, 2025 23:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes the levenshteinWithMax function by introducing buffer reuse through a sync.Pool to reduce memory allocations during Levenshtein distance calculations. This addresses performance issues identified in issue #1640 where the function was a top allocator during tests.

  • Introduces a pooled buffer system to reuse slice allocations
  • Replaces direct slice creation with buffer reuse from a sync.Pool
  • Uses slices.Grow to efficiently resize reused buffers

@jakebailey jakebailey enabled auto-merge October 22, 2025 19:16
@jakebailey jakebailey added this pull request to the merge queue Oct 22, 2025
Merged via the queue into main with commit 48b739c Oct 22, 2025
22 checks passed
@jakebailey jakebailey deleted the jabaile/spelling-perf branch October 22, 2025 19:32
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.

3 participants