Both modules have a crc32 function. The zlib version is faster when zlib has been compiled optimally or about the same when zlib is old or uses its C code.<br><br>Should we ditch the binascii.crc32 version in py3k?<br><br>
64bit Linux (CentOS 5.1):<br><br>$ python2.4 -m timeit 'foo="abcdefghijklmnop"*10' 'import <span style="font-weight: bold;">binascii</span> as mod' 'f = mod.crc32' 'for x in xrange(100000): f(foo)'<br>
10 loops, best of 3: 108 msec per loop<br>$ python2.4 -m timeit 'foo="abcdefghijklmnop"*10' 'import <span style="font-weight: bold;">zlib</span> as mod' 'f = mod.crc32' 'for x in xrange(100000): f(foo)'<br>
10 loops, best of 3: 40.5 msec per loop<br><br>32bit MacOS X 10.4:<br><br>% python2.3 /usr/lib/python2.3/timeit.py 'foo="abcdefghijklmnop"*10' 'import <span style="font-weight: bold;">binascii</span> as mod' 'f = mod.crc32' 'for x in xrange(100000): f(foo)'<br>
10 loops, best of 3: 7.37e+04 usec per loop<br>% python2.3 /usr/lib/python2.3/timeit.py 'foo="abcdefghijklmnop"*10' 'import <span style="font-weight: bold;">zlib</span> as mod' 'f = mod.crc32' 'for x in xrange(100000): f(foo)'<br>
10 loops, best of 3: 4.62e+04 usec per loop<br>
<br>Removal from binascii would break things for platforms or embedded systems wanting crc32 that don't want to include zlib. Anyone care?<br><br>What about 2.x? if we remove the redundancy in py3k i guess we deprecate binascii.crc32 and remove in 2.7?<br>
<br>-gps<br>