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 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

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.

1 participant