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

improve performance (slightly) #118

Merged
merged 2 commits into from Aug 23, 2021
Merged

Conversation

flavorjones
Copy link
Member

This PR will make one less method call per element in a document.

Also rewrite the test coverage for PIs and comments from ab16fa4 to test behavior and not implementation.

@flavorjones
Copy link
Member Author

flavorjones commented Aug 20, 2021

Benchmark results running on a ~70kb real-world HTML document (https://github.com/sparklemotion/nokogiri/blob/main/test/files/tlm.html):

Warming up --------------------------------------
               1.4.1     1.000  i/100ms
            proposed     1.000  i/100ms
Calculating -------------------------------------
               1.4.1     13.480  (±29.7%) i/s -     64.000  in   5.036261s
            proposed     13.893  (±28.8%) i/s -     66.000  in   5.021529s

Comparison:
            proposed:       13.9 i/s
               1.4.1:       13.5 i/s - same-ish: difference falls within error

@flavorjones flavorjones force-pushed the flavorjones-tweak-comment-and-pi branch from 51e75dc to 692eb8a Compare August 20, 2021 19:51
to test behavior and not implementation.
Assuming elements are more common than comments, this is going to be
one less method call per node.
Copy link
Contributor

@kaspth kaspth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call 👍

@flavorjones flavorjones merged commit d494309 into master Aug 23, 2021
@flavorjones flavorjones deleted the flavorjones-tweak-comment-and-pi branch August 23, 2021 21:54
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.

None yet

2 participants