Skip to content

Reduce memory usage for rune width cache.#1756

Merged
patriksvensson merged 3 commits intospectreconsole:mainfrom
Pannoniae:main
Jun 20, 2025
Merged

Reduce memory usage for rune width cache.#1756
patriksvensson merged 3 commits intospectreconsole:mainfrom
Pannoniae:main

Conversation

@Pannoniae
Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Done

@Pannoniae
Copy link
Copy Markdown
Contributor Author

will this be merged?

@patriksvensson patriksvensson merged commit 7f3ebe0 into spectreconsole:main Jun 20, 2025
@patriksvensson
Copy link
Copy Markdown
Contributor

Merged! Thank you for your contribution. Much appreciated! 👍

@Pannoniae
Copy link
Copy Markdown
Contributor Author

thanks!<3

This was referenced Sep 8, 2025
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