If you pass a byte string to BeautifulSoup, without also giving it an encoding, it has to guess the encoding before parsing, which is computationally intensive. BeautifulSoup is used frequently in our tests. Passing an encoding to BeautifulSoup in the tests, where it is used on byte strings, made them complete 1.9% faster, in the average of several runs on my laptop.
If you pass a byte string to
BeautifulSoup
, without also giving it an encoding, it has to guess the encoding before parsing, which is computationally intensive.BeautifulSoup
is used frequently in our tests. Passing an encoding toBeautifulSoup
in the tests, where it is used on byte strings, made them complete 1.9% faster, in the average of several runs on my laptop.