-
-
Notifications
You must be signed in to change notification settings - Fork 905
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: RelaxNG.read_memory is now reliable (#3259)
**What problem is this PR intended to solve?** On both JRuby and CRuby impls, replace the native `read_memory` method from XML::Schema and XML::RelaxNG with a ruby method that uses `from_document`. `read_memory` was buggy on both platforms, but especially on the JRuby impl. This is comparable in performance on CRuby. From a benchmark taken before this change: ``` Warming up -------------------------------------- Schema.new 1.219k i/100ms Schema.from_document 1.258k i/100ms Schema.read_memory 1.118k i/100ms Calculating ------------------------------------- Schema.new 12.160k (± 8.3%) i/s - 121.900k in 10.093638s Schema.from_document 12.216k (± 8.6%) i/s - 122.026k in 10.059696s Schema.read_memory 12.790k (±10.7%) i/s - 127.452k in 10.105931s Comparison: Schema.read_memory: 12789.6 i/s Schema.from_document: 12215.9 i/s - same-ish: difference falls within error Schema.new: 12160.1 i/s - same-ish: difference falls within error ``` IMHO the resulting code is less buggy and easier to maintain, and the slight (if any) performance hit is worth it. Also: improve documentation for Schema and RelaxNG classes. Closes #2113 Closes #2115 **Have you included adequate test coverage?** Yes. **Does this change affect the behavior of either the C or the Java implementations?** Brings JRuby and CRuby into alignment.
- Loading branch information
Showing
7 changed files
with
226 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.