codersofthedark
codersofthedark

Reputation: 9665

Xpath vs DOM vs BeautifulSoup vs lxml vs other Which is the fastest approach to parse a webpage?

I know how to parse a page using Python. My question is which is the fastest method of all parsing techniques, how fast is it from others?

The parsing techniques I know are Xpath, DOM, BeautifulSoup, and using the find method of Python.

Upvotes: 6

Views: 5359

Answers (2)

CuriousD
CuriousD

Reputation: 1775

lxml was written on C. And if you use x86 it is best chose. If we speak about techniques there is no big difference between Xpath and DOM - it's very quickly methods. But if you will use find or findAll in BeautifulSoup it will be slow than other. BeautifulSoup was written on Python. This lib needs a lot of memory for parse any data and, of course, it use standard search methods from python libs.

Upvotes: 1

Related Questions