-
-
Notifications
You must be signed in to change notification settings - Fork 903
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
XMLNodeSet::xpath and XMLNodeSet::css are very slow with large number of nodes #1795
Labels
Milestone
Comments
Based on the profiling I did, it looks like RubyArray#op_or is where we spend most of the time. To be more specific most of the time is spent calculating hashes of the objects here. |
jvshahid
added a commit
that referenced
this issue
Sep 15, 2018
The current implementation suffers from having poor performance. More specifically, `op_or' is order of magnitude slower than the MRI version slows down XMLNodeSet::xpath and XMLNodeSet::css significantly. This commit rewrites the class to manage its own internal array, similar to what libxml does. fixes #1795
flavorjones
pushed a commit
that referenced
this issue
Dec 1, 2018
The current implementation suffers from having poor performance. More specifically, `op_or' is order of magnitude slower than the MRI version slows down XMLNodeSet::xpath and XMLNodeSet::css significantly. This commit rewrites the class to manage its own internal array, similar to what libxml does. fixes #1795
flavorjones
pushed a commit
that referenced
this issue
Dec 1, 2018
The current implementation suffers from having poor performance. More specifically, `op_or' is order of magnitude slower than the MRI version slows down XMLNodeSet::xpath and XMLNodeSet::css significantly. This commit rewrites the class to manage its own internal array, similar to what libxml does. fixes #1795
This was referenced Mar 14, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is extracted from #1792 (comment)
Here is the test script I am using:
Here is the output with 5000 divs:
And here is the output with 50,000 divs:
So in both cases the nested version is several orders of magnitude slower than the unnested version. And it seems to get exponentially worse for larger numbers of matched elements.
The text was updated successfully, but these errors were encountered: