Skip to content

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.
@flavorjones flavorjones force-pushed the flavorjones-tweak-comment-and-pi branch from 692eb8a to b1fe437 Compare August 20, 2021 19:53
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.

2 participants