Fatest standard way to sum bytes (and their squares)?
Erik Max Francis
max at alcyone.com
Mon Aug 13 02:14:19 CEST 2007
Alexander Schmolck wrote:
> Is this any faster?
> ordSum, orsSumSq = (lambda c:c.real,c.imag)(sum(complex(ord(x),ord(x)<<1)
> for x in data))
That's pretty clever, but I neglected to mention that I need to
accumulate the sums as ints/longs to avoid losing precision, so
converting to floating point isn't an optional. (The sums are
normalized by the sizes of the files and expanded to 32 bits in order to
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfrancis
Experience is the name everyone gives to their mistakes.
-- Oscar Wilde
More information about the Python-list