-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Make findAll non-recursive to avoid stack overflows #22
Conversation
Could you provide a benchmark? It would be interesting to see which performance implications this has. |
Also this is a switch from depth- to breadth-first search and therefore alters the result. |
I just tested 5 variations of findAll with 6000 selectors in a total of 21 pages using cheerio in node 6.3.0. original: 5710ms (144%) @sirwart 's solution with a tiny twist is the fastest, probably consumes the least memory and solves potential stack overflows. Publishing this update translates in a direct 35% test functions:
(1)
(2) storing the result in an object to avoid pushes and concats
(3)
|
Hi, was wondering if this patch is planned to be merged? I'm not sure if the breadth vs depth-first change has any functional impact. I run across this same error occasionally in production and am glad I found this thread. |
No description provided.