Hm. zlib is an odd place to find this API (unless you know way more about gzip than healthy :-). Though binascii isn't much better. I'd rather expect this in the vicinity of md5 and sha... Is it possible to tweak that C code to use the zlib version if present and the old C code otherwise?
On Tue, Mar 18, 2008 at 3:21 PM, Gregory P. Smith <[EMAIL PROTECTED]> wrote: > 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. > > Should we ditch the binascii.crc32 version in py3k? > > 64bit Linux (CentOS 5.1): > > $ python2.4 -m timeit 'foo="abcdefghijklmnop"*10' 'import binascii as mod' > 'f = mod.crc32' 'for x in xrange(100000): f(foo)' > 10 loops, best of 3: 108 msec per loop > $ python2.4 -m timeit 'foo="abcdefghijklmnop"*10' 'import zlib as mod' 'f = > mod.crc32' 'for x in xrange(100000): f(foo)' > 10 loops, best of 3: 40.5 msec per loop > > 32bit MacOS X 10.4: > > % python2.3 /usr/lib/python2.3/timeit.py 'foo="abcdefghijklmnop"*10' 'import > binascii as mod' 'f = mod.crc32' 'for x in xrange(100000): f(foo)' > 10 loops, best of 3: 7.37e+04 usec per loop > % python2.3 /usr/lib/python2.3/timeit.py 'foo="abcdefghijklmnop"*10' 'import > zlib as mod' 'f = mod.crc32' 'for x in xrange(100000): f(foo)' > 10 loops, best of 3: 4.62e+04 usec per loop > > Removal from binascii would break things for platforms or embedded systems > wanting crc32 that don't want to include zlib. Anyone care? > > What about 2.x? if we remove the redundancy in py3k i guess we deprecate > binascii.crc32 and remove in 2.7? > > -gps > > _______________________________________________ > Python-3000 mailing list > Python-3000@python.org > http://mail.python.org/mailman/listinfo/python-3000 > Unsubscribe: > http://mail.python.org/mailman/options/python-3000/guido%40python.org > > -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com