-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConfigParser 50x slower in 2.7 #55298
Comments
The ConfigParser class in 2.7 is almost >50 times slower than in the 2.6 which for large files it renders it almost unusable. Actually the speed decrease depends on the amount of the stored data Results from test program: Python 2.6.4 (r264:75706, Jun 4 2010, 18:20:31) |
If OrderedDict is used, the test case quickly uses 8GB of memory. With Index: Lib/ConfigParser.py --- Lib/ConfigParser.py (revision 88298)
+++ Lib/ConfigParser.py (working copy)
@@ -92,6 +92,7 @@
except ImportError:
# fallback for setup.py which hasn't yet built _collections
_default_dict = dict
+_default_dict = dict
import re |
Commenting-out the The RawConfigParser() class doesn't seem to have the same issue. Looking at the 2.7 code for ConfigParser.get() shows that it is doing a lot more than just getting. For example, it does a full copy of defaults dictionary on every call !? I'll look at it more shortly. |
Attaching a patch that fixes the algorithmic atrocities by using the Chainmap recipe: http://code.activestate.com/recipes/305268-chained-map-lookups |
Fixed for 2.7 in r88318. Will make a similar fix for 3.1.4 and for 3.2.1. |
Attaching patch for Python 3.2. Georg, I was think of waiting for 3.2.1 for this one, but it can go into 3.2.0 RC2 if you prefer. |
3.2.1 should be fine. |
Fixed 3.1 in r88323. |
See r88469 and r88470. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: