[Python-Dev] mimetypes and _winreg
Garth
garth at garthy.com
Tue Jun 22 11:34:57 EDT 2004
Guido van Rossum wrote:
>>I could file a patch if no one else is looking at it. The solution would
>>be to use
>>
>>RegEnumKeyEx and remove RegQueryInfoKey. This loses compatability
>>with win16 which I guess is ok.
>>
>>
>
>Indeed. Would you mind filing a patch? (If you've already done so,
>my apologies -- do you know the patch #?)
>
>--Guido van Rossum (home page: http://www.python.org/~guido/)
>
>
>
Ok done it here. patch number 977553.
https://sourceforge.net/tracker/index.php?func=detail&aid=977553&group_id=5470&atid=305470
Some bench mark values for the script below:-
python 2.3 5531 89.7130000591
python 2.4 +patch 5531 0.0469999313354
start = time.time()
i = 0
try:
while 1:
_winreg.EnumKey(_winreg.HKEY_CLASSES_ROOT, i)
i += 1
except WindowsError:
pass
print i, time.time() - start
The max size of a key was taken from the MS Platform SDK.
I hope you don't mind the 255 byte array on the stack?
Not a recursive function so it shouldn't matter too much.
I've noticed a few things while looking at the winreg module.
* No unicode support
* This patch concept could be applied to other functions in this module
to speed up stuff.
May sort out the rest of this but not soon as I'm off to Glastonbury
tomorrow so if there's any problems I may not respond for a while.
Garth
More information about the Python-Dev
mailing list