Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PERFORMANCE: Lucene.Net.Analysis.TokenAttributes.CharTermAttribute: Optimized char copying on Append() and Subsequence() #899

Merged

Conversation

NightOwl888
Copy link
Contributor

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a change, please open an issue to discuss the change or find an existing issue.

Summary of the changes (Less than 80 chars)

PERFORMANCE: Lucene.Net.Analysis.TokenAttributes.CharTermAttribute: Optimized char copying on Append() and Subsequence()

Description

This removes some allocations from the StringBuilder overloads of Append() and switches from using a for loop to Arrays.Copy() for Subsequence().

…ubsequence(): Changed to using Arrays.Copy() to copy the array instead of a for loop.
…ppend(): Use StringBuilder.CopyTo() to copy the chars instead of allocating a string.
@NightOwl888 NightOwl888 merged commit d740f13 into apache:master Jan 19, 2024
197 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant