3 ms·
Haha, thank you mercuryrising. That's quite the interesting comparison. A few thoughts: - Python.org is quite a simple web app, it would be interesting to run
by kami8845 14y ago
Haha, thank you mercuryrising. That's quite the interesting comparison. A few thoughts:
- Python.org is quite a simple web app, it would be interesting to run this against something a little more complex like a long wikipedia article or http://www.nytimes.com/ http://www.nytimes.com/ or even the Alexa Top 500
- It would also be interesting to split the times between parsing and selecting as I feel that's where the difference between pq and lxml comes in.
All in all it seems BS4 is quite a bit faster than I gave it credit for (especially factoring in parsing+selecting instead of just the former)
- mercuryrising 14y agoPython.org was pretty simple. bs4 really hits the brakes on the NYT page. ==== Total trials: 100000 ===== bs4 parsing time: 0.6 bs4 selecting time: 146.3 pq parsing time: 0.0 pq selecting: 15.7 lxml parsing time: 0.0 lxml (cssselect) selecting time: 12.4 lxml parsing time: 0.0 lxml (xpath) selecting: 11.5
- kami8845 14y agoThat seems more in line with my experience :) This is the stuff lxml shines at. Thank you for testing this out.