Live data from Hacker News

That XOR Trick (2020)

florian.github.io

1–10 of 141 posts

Re: That XOR Trick (2020)

#5
Why do people hate traditional for loops so much? In a conversation about petty micro optimizations, we end up performing two loops instead of one, all because sticking three operations in one statement is "yucky"?

Re: That XOR Trick (2020)

#6

Why do people hate traditional for loops so much? In a conversation about petty micro optimizations, we end up performing two loops instead of one, all because sticking three operations in one statement is "yucky"?

I think it's just an interesting approach to solving particular limited problems. If I needed to solve this I'd end up either using set arithmetic or sorting the list, both of which use more memory and time. Maybe down low in some compiler loop or JVM loop this could be the difference between a sluggish application and a snappy one

Re: That XOR Trick (2020)

#7
post #4

The first thing that occurred to me is that if a number is missing from a list, the sum of that list will fall short. But I like XOR's.

It really tickles my brain in a lovely way that it avoids all overflow risk as well
Post reply on HN