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

Add support for Ruby 3.4 #445

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

Add support for Ruby 3.4 #445

wants to merge 3 commits into from

Conversation

czj
Copy link

@czj czj commented Jan 2, 2025

This pull request updates XML generation to be compatible with Ruby 3.4's default frozen string literals and optimizes string handling for better performance.

  • It resolves warnings when running the gem in a Ruby 3.4 application, where frozen string literals are enabled by default, and prepares for Ruby 3.5's upcoming default behavior. This change anticipates frozen_string_literals becoming the default in Ruby 3.5.

  • It expands test coverage by adding Ruby 3.4 to the test matrix to ensure compatibility with the latest Ruby version.

  • It optimizes memory usage in XML generation by preventing unnecessary string duplication when writing. It eliminates the need to duplicate entire strings when adding wrappers at the beginning and end, significantly reducing memory allocations and garbage collections, which is particularly beneficial for generating large sitemaps.

czj added 3 commits January 2, 2025 11:05
Addresses warnings when running the gem in a Ruby 3.4 app, which has frozen string literals warning enabled by default. Ruby 3.5 will have frozen string literals turned on by default.

Signed-off-by: Clément Joubert <[email protected]>
With a very large file, we avoid duplicating the whole string just to add the wrapper at the begging then at the end.

I think this should save a lot on memory allocations and garbage collections on large sitemaps.
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