ox
ox copied to clipboard
Use "interned" (frozen and deduplicated) Strings in Ruby 3.0+ to minimize object allocations.
I have a PR ready to go for this feature but this can be for discussion of the general concept.
- Background info: https://en.wikipedia.org/wiki/String_interning
- Available to C extensions since MRI Ruby 3.0:
- https://bugs.ruby-lang.org/issues/13381
- https://bugs.ruby-lang.org/issues/16029
- Like https://ruby-doc.org/core/String.html#method-i-2B-40
For what it's worth Ox is already the fastest Ruby XML parser for my use case even without this change. My library wouldn't be feasible without it since it's the only one that can parse shared-mime-info
faster than ruby-mime-types
starts up, so thank you! https://github.com/okeeblow/DistorteD/blob/master/CHECKING-YOU-OUT/docs/XML.md#Benchmarks
I'll look over this tonight. Good to know about the latests string optimizations.
Can this be closed? Is it still relevant?