-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Some CSS query find elements very slowly #1956
Comments
What platform are you on? I tried this and on my M1, it took 7.1 seconds (first run, no hotspot etc). Certainly it would be good to improve that, but I wonder if something else is impacting the speed? |
I am running on Android platform and my phone chip is Snapdragon 660. [Snipped large images] |
This amount of operations looks like an exponential increase. You can try how long this document takes: https://www.123duw.com/dudu-32/50731/ |
OK, surprised that it performs so differently on Android. I guess the combination of the high query count and the memory allocation in nth-of-type is causing the difference in. Yes, I believe the |
Thanks for reporting this! I have optimized the selector by changing the query evaluation order of the I also improved the memory consumption (by removing ephemeral calls to So I expect you will see a good improvement; if you could test with a snapshot version and report back that would be great! Future work would be to improve in what order the |
I made the memoization a bit more generic, so that it applies to each of the Structural Evaluators. And made it more correct so that reused Evaluators have a ThreadLocal memo. |
Example document : https://www.123duw.com/dudu-38/51311/
CSS query :
dl > dt:nth-of-type(2) ~ dd > a
In jsoup, It took about 4 minutes.
In Chrome, it took only 50ms to complete.
jsoup version : 1.16.1
The text was updated successfully, but these errors were encountered: