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

Reduce memory usage for rune width cache. #1756

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Pannoniae
Copy link

@Pannoniae Pannoniae commented Feb 7, 2025

  • I have read the Contribution Guidelines
  • I have commented on the issue above and discussed the intended changes
  • A maintainer has signed off on the changes and the issue was assigned to me
  • All newly added code is adequately covered by tests
  • All existing tests are still running without errors
  • The documentation was modified to reflect the changes OR no documentation changes are required.

Changes

The rune width cache array consumes half a megabyte because it uses a Nullable to store values. This PR slashes the memory requirements to an eighth of what it was before with no loss of functionality.


Please upvote 👍 this pull request if you are interested in it.

@Pannoniae
Copy link
Author

@microsoft-github-policy-service agree

Copy link
Contributor

@phil-scott-78 phil-scott-78 left a comment

Choose a reason for hiding this comment

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

I think I was the last to touch this an it looks good to me. Pulled it down and tested it, all good. Slightly faster. Only thing I'd be tempted to change would be using Array.Fill instead of the loop to grab some perf since that's the goal here, but we'd need a polyfill or a conditional for a fall back to the loop for netstandard 2.0

@Pannoniae
Copy link
Author

Done

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