Feature: Add Ox for Improved Performance #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a significant performance improvement by refactoring the
EasySax.parser
implementation to use ox as the underlying parser instead ofNokogiri
.The new
ox_parser
method is fully backward compatible with the currentparser
implementation, ensuring no breaking changes for existing users.Note
While working on the EasyBroker challenge, I realized that achieving good performance and efficient memory usage requires a deeper analysis of the current implementation.
Key Changes
ox_parser
as an alternative parser method.ox_parser
is ~52% faster thanEasySax.parser
using Nokogiri.ox_parser
reduces allocated memory by ~35% and cuts object allocations by ~52%.ox_parser
method and performance results.Benchmark Results
Environment:
Results:
Changelog
New Features
ox_parser
for faster and more memory-efficient XML parsing, while maintaining backward compatibility withEasySax.parser
.Enhancements
Nokogiri
andOx
parsers.ox_parser
.Documentation
ox_parser
method and its performance benefits.Code Quality
Dependency Updates
Ox
as a dependency in the Gemfile for improved performance..gitignore
to exclude.ruby-gemset
and.ruby-version
files.