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

Simplify XML parser using IO#gets #42

Closed
wants to merge 2 commits into from
Closed

Simplify XML parser using IO#gets #42

wants to merge 2 commits into from

Conversation

martijn
Copy link
Owner

@martijn martijn commented Jun 9, 2022

No description provided.

@martijn
Copy link
Owner Author

martijn commented Jun 9, 2022

Turns out this is actually a lot slower and allocating more due to how #read is implemented in Rubyzip. This is probably why I went with sysread initially :)

./benchmark.rb on main

--- ARRAY MODE ---
Performance benchmark: 1.0193964000092819s avg 0.009340342315816343s stdev
Calculating -------------------------------------
                       883.133M memsize (     1.007k retained)
                         2.373M objects (    12.000  retained)
                        50.000  strings (     2.000  retained)

--- HASH MODE ---
Performance benchmark: 1.4067317999899387s avg 0.04825439805105081s stdev
Calculating -------------------------------------
                       886.334M memsize (     1.650k retained)
                         2.433M objects (    16.000  retained)
                        50.000  strings (     3.000  retained)

./benchmark.rb on bufferless-parser

--- ARRAY MODE ---
Performance benchmark: 2.526302199973725s avg 0.02019858371069751s stdev
Calculating -------------------------------------
                         8.051B memsize (     1.007k retained)
                         3.593M objects (    12.000  retained)
                        50.000  strings (     2.000  retained)

--- HASH MODE ---
Performance benchmark: 3.0494400000199677s avg 0.17171053600326805s stdev
Calculating -------------------------------------
                         8.054B memsize (     1.650k retained)
                         3.653M objects (    16.000  retained)
                        50.000  strings (     3.000  retained)

@martijn martijn marked this pull request as draft June 9, 2022 14:29
@martijn martijn closed this Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant