-
-
Notifications
You must be signed in to change notification settings - Fork 905
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
[bug] [jruby] RelaxNG.read_memory does not work #2115
Labels
Milestone
Comments
flavorjones
added
state/needs-triage
Inbox for non-installation-related bug reports or help requests
platform/jruby
and removed
state/needs-triage
Inbox for non-installation-related bug reports or help requests
labels
Nov 27, 2020
flavorjones
added a commit
that referenced
this issue
Nov 28, 2020
and also raise a better-formatted exception in that case
flavorjones
added a commit
that referenced
this issue
Dec 3, 2020
and also raise a better-formatted exception in that case
Closed
flavorjones
added a commit
that referenced
this issue
Jun 24, 2024
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. Closes #2113 Closes #2115
flavorjones
added a commit
that referenced
this issue
Jun 24, 2024
**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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please describe the bug
While working on an unrelated issue with schema parsing, I noticed that there was no test coverage of
XML::RelaxNG.read_memory
and that running a simple test case causes an exception to be raised.Help us reproduce what you're seeing
results, using Nokogiri v1.10.10, in:
Expected behavior
Running this in CRuby parses the schema successfully.
Environment
Additional context
Digging in on the type of exception raise, it's a
java.net.MalformedURLException
being raised byfactory.compileSchema(is);
inXmlRelaxng.java
for aStreamSource
source.The text was updated successfully, but these errors were encountered: