3 ms·
Is PyQuery fast? The whole premise of the first point was that BeautifulSoup was too slow, but then he didn't provide a comparison between them.
by Permit 14y ago
Is PyQuery fast? The whole premise of the first point was that BeautifulSoup was too slow, but then he didn't provide a comparison between them.
- tiramisou 14y agoIt uses lxml, so yes it is fast.
- streblo 14y agoSo does BeautifulSoup
- deleted 14y ago[deleted]
- kami8845 14y agoHey Permit. This is a really good point. Looking at PyQuery's source code [0], it really does nothing in terms of parsing other than calling lxml's fromstring function and then works with the result of that when evaluating queries. So it would probably be a tad slower than pure lxml since it also does other bits (like checking for URLs and then fetching them for you) but from looking at the source code, I'd think that the overhead is minimal. [0] https://github.com/dsc/pyquery/blob/master/pyquery/pyquery.py#L179 https://github.com/dsc/pyquery/blob/master/pyquery/pyquery.p...
- randallma 14y agoThe comparison should be moot, because Beautiful Soup 4 uses the lxml parser when it's available: http://www.crummy.com/software/BeautifulSoup/bs4/doc/#specifying-the-parser-to-use http://www.crummy.com/software/BeautifulSoup/bs4/doc/#specif...