XORing on arrays faster?

rdudfield at my-deja.com rdudfield at my-deja.com
Wed Feb 16 01:58:18 EST 2000


Hello,

Anyone know how to do XORing on arrays fast?

I do not want to use the Numeric package, for other reasons.  So that is
out of the question. BTW using Numeric XORing two arrays is more than
four times as fast as this method.

a = array.array('I',[0]) * 1000
b = array.array('I','\377\377\377\377') * 1000

# this is the bit I want done faster :)
for x in xrange(1000):
  a[x] = a[x] ^ b[x]


Also if you know a way to map one sequence onto another fast, I'd like
to know how to do that too :)

Thanks for any help.

Rene.


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list