Xpath vs DOM vs BeautifulSoup vs lxml vs other What is the fastest approach to analyzing a web page?

I know how to parse a page using Python. My question is what is the fastest method of all parsing methods, how fast does this come from others?

The analysis methods that I know are Xpath, DOM, BeautifulSoup and using the find method for Python.

+4
source share
2 answers

lxml was written in C. And if you are using x86, this is the best choice. If we talk about methods, then there is not much difference between the Xpath and the DOM - these are very fast methods. But if you use find or findAll in BeautifulSoup, it will be slower than others. BeautifulSoup was written in Python. This library requires a lot of memory to analyze any data and, of course, uses standard search methods from python libraries.

+1
source

Source: https://habr.com/ru/post/1384117/


All Articles