02-14-2007 01:39 PM
02-14-2007 02:35 PM
02-14-2007 04:26 PM
02-14-2007 04:37 PM
02-14-2007 04:47 PM - edited 02-14-2007 04:47 PM

Message Edited by altenbach on 02-14-2007 02:50 PM
02-14-2007 05:52 PM - edited 02-14-2007 05:52 PM
I take the challenge
@altenbach wrote:I doubt you can count the number of bit differences much faster that this. 😄

Message Edited by Tomi M on 02-15-2007 01:52 AM
02-14-2007 06:37 PM - edited 02-14-2007 06:37 PM
That's NOT "much faster". 😄
Yes, you can throw much more code at it and (in the limiting case of few errors) you might win. Still, even "search array" needs to look at each element one way or another.
Then there's the cost of allocation a full-sized boolean array, and if the errors are more frequent, huge output arrays that you sum later. Try it with an array that barely fits in memory and it won't be pretty. 😮
Here's a very simple potential improvement that skips the lookup, addition, and coercion if no error exists. See if it does any better. 🙂

(Other case is "0" and just carries the shift register value across)
Message Edited by altenbach on 02-14-2007 04:39 PM
02-14-2007 07:16 PM
@altenbach wrote:
Here's a very simple potential improvement that skips the lookup, addition, and coercion if no error exists. See if it does any better. :)
Some casual testing with your random test data skeleton:
No case structure: 170ms (Seems our PCs are about the same speed).
With case structure: 90ms
Almost double the speed. 🙂
Interesting. I'm sure it could be still be optimized for multiprocessor, dual core, etc. It shoud scale well, since everything could be done in parallel.
02-15-2007 01:29 AM
02-15-2007 02:13 AM
@Tomi M wrote:
Altenbach, you won! 🙂
Well, you should have known better than trying to have an optimization contest with Altenbach. It's normally a recipe for losing (and for learning
), and being the sole user of other obscure LV features (I hope Stephen doesn't read this) does not mean you can handle these minute details as well. ![]()