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

Stop requiring stringio dynamically #219

Merged
merged 2 commits into from
Nov 6, 2024
Merged

Stop requiring stringio dynamically #219

merged 2 commits into from
Nov 6, 2024

Conversation

jsvd
Copy link
Contributor

@jsvd jsvd commented Oct 30, 2024

SourceFactory::create_from(String) will always run the require 'stringio' operation. This prevents a multi-threaded JRuby application from parsing xml on separate threads concurrently given that require will pass through a synchronized piece of code.

An experiment in removing this require lead to a 10x performance improvement on 10 threads parsing incoming strings on xml. For more details see logstash-plugins/logstash-filter-xml#83

`SourceFactory::create_from(String)` will always run the `require 'stringio'` operation. This prevents a multi-threaded JRuby application from parsing xml on separate threads concurrently given that `require` will pass through a synchronized piece of code.

An experiment in removing this `require` lead to a 10x performance improvement on 10 threads parsing incoming strings on xml.
For more details see logstash-plugins/logstash-filter-xml#83
lib/rexml/source.rb Outdated Show resolved Hide resolved
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
@jsvd jsvd marked this pull request as ready for review October 30, 2024 22:59
@kou kou changed the title Remove 'require' from hot path to allow multi-threaded parsing in JRuby Stop requiring stringio dynamically Nov 6, 2024
@kou kou merged commit ed9168e into ruby:master Nov 6, 2024
61 checks passed
@kou
Copy link
Member

kou commented Nov 6, 2024

Thanks.

@jsvd jsvd deleted the patch-1 branch November 12, 2024 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants