Jul
26
comment Why is this recursion so much faster than equivalent iteration?
Wow. That's really cool. Thank you for this answer, it is exactly what I was looking for. I'm surprised gcc optimized the recursive version so much better, but at least I now know what it did.
Jul
26
revised Why is this recursion so much faster than equivalent iteration?
added 342 characters in body
Jul
26
comment Why is this recursion so much faster than equivalent iteration?
@Roman Adding those flags had an extremely surprising effect: gist.github.com/PatrickAupperle/3a87eb53a9f11c1f0bec Still a big difference, though. And still favoring recursion. Way faster, though.
Jul
26
comment Why is this recursion so much faster than equivalent iteration?
@Cheersandhth.-Alf I thought about that, but 25 lines of output in 25 seconds should do almost nothing. Also, both sets have the same exact output.
Jul
26
comment Why is this recursion so much faster than equivalent iteration?
@BenVoigt I am curious about this particular code. The speed is meaningless to me, but the difference is intriguing.
Jul
26
revised Why is this recursion so much faster than equivalent iteration?
added 232 characters in body
Jul
26
revised Why is this recursion so much faster than equivalent iteration?
added 3 characters in body
Jul
26
revised Why is this recursion so much faster than equivalent iteration?
deleted 13 characters in body
Jul
26
revised Why is this recursion so much faster than equivalent iteration?
added 149 characters in body
Jul
26
asked Why is this recursion so much faster than equivalent iteration?
Apr
29
comment Integer not comparing equal to its value
That is very interesting. It does make sense.
Apr
29
accepted Integer not comparing equal to its value
Apr
29
comment Integer not comparing equal to its value
Thank you. I didn't realize that running out of bounds could break the future comparison, so I didn't worry about that part of the code. I would certainly have used a container, but this code was given to me in this state. It would be quite interesting to learn how that breaks the comparison between 6 and 6.
Apr
29
comment Integer not comparing equal to its value
It looks like you are correct about the problem. Changing the size to 7 fixes the problem. I had noticed that it was running over the end of the array (I didn't write the code), but didn't think it mattered since I was getting the number 6 back. I would be very interested to learn why this breaks the comparison.
Apr
29
comment Integer not comparing equal to its value
The size of ch->fb is 6.
Apr
29
revised Integer not comparing equal to its value
added 97 characters in body
Apr
29
revised Integer not comparing equal to its value
added 59 characters in body
Apr
29
comment Integer not comparing equal to its value
I can't create a minimum, complete, and verifiable example. I realize it is recommended that you do so, but I can't seem to create one that triggers this problem.
Apr
29
revised Integer not comparing equal to its value
added 33 characters in body
Apr
29
comment Integer not comparing equal to its value
I'll add the condition to the question, since it seems to somehow be causing this.
1 2 3 4 5