New submission from albert hofkamp <a.t.hofk...@tue.nl>:

Current implementation (r71564) uses "'%s\n%s' % (old_val, new_line)" to
merge multi-line options into one string.
For options with many lines, this wastes a lot of CPU power.

Attached patch against r71564 fixes this problem by first building a
list of lines for each loaded option, and after reading the whole file,
merging them with the already loaded data. In that way, the '\n'.join()
can be performed once.
Patched ConfigParser.py works against test/test_cfgparser.py (and Python
2.5)

We have witnessed a reduction from 4 hours to 3 seconds loading time
with Python 2.6 and an option of 800000 lines.

----------
components: Library (Lib)
files: speedfix_71564.patch
keywords: patch
messages: 93895
nosy: aioryi
severity: normal
status: open
title: ConfigParser load speedup
type: performance
versions: Python 2.6
Added file: http://bugs.python.org/file15109/speedfix_71564.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7113>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to