[issue21448] Email Parser use 100% CPU
Serhiy Storchaka
report at bugs.python.org
Sat Aug 2 15:26:55 CEST 2014
Serhiy Storchaka added the comment:
Parser reads from input file small chunks (8192 churacters) and feed FeedParser which pushes data into BufferedSubFile. In BufferedSubFile.push() chunks of incomplete data are accumulated in a buffer and repeatedly scanned for newlines. Every push() has linear complexity from the size of accumulated buffer, and total complexity is quadratic.
Here is a patch which fixes problem with parsing long lines. Feel free to add comments if they are needed (there is an abundance of comments in the module).
----------
keywords: +patch
Added file: http://bugs.python.org/file36210/email_parser_long_lines.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21448>
_______________________________________
More information about the Python-bugs-list
mailing list