05-04-2015 10:46 AM
@jcarmody wrote:
I'm in the high 30's, now...
That's the best I was able to get. 3 ms is sure hard to beat 🙂
Ben64
05-04-2015 11:11 AM - edited 05-04-2015 11:13 AM
@jcarmody wrote:
I'm in the high 30's, now...
I cut it in half. 🙂 I wonder if the string conversion is the bottleneck?
05-04-2015 11:34 AM
05-04-2015 11:44 AM
05-04-2015 12:01 PM - edited 05-04-2015 12:09 PM
@jcarmody wrote:
I made it.
I guess you should go back to the drawing board. On a more modern computer mine is well below 0.8ms (now on a 3.1GHz CPU, most likley even faster on a current generation CPU). Only using one core.
Remember, the 3ms was on an ancient laptop. 😄
05-04-2015 12:14 PM
altenbach wrote:
I guess you should go back to the drawing board. On a more modern computer mine is well below 0.8ms (now on a 3.1GHz CPU, most likley even faster on a current generation CPU). Only using one core.
Remember, the 3ms was on an ancient laptop. 😄
I was happy to do better than brute-force.
05-04-2015 02:39 PM
I'm hitting 0.22 ms (single core) by observing that all 6 digit palindromes are multiples of 11, by not using string compare, not bothing to do a palindrome check for any products smaller than my currently largest product, and by starting from 999 and working backwards.
05-04-2015 02:49 PM
@Oligarlicky wrote:
I'm hitting 0.22 ms (single core) by observing that all 6 digit palindromes are multiples of 11,....
Ah, did not know that. OK, if I include that test, mine drops to 0.12ms (Still using string compare, though) 😄
05-04-2015 03:12 PM
@Oligarlicky wrote:
[...] by observing that all 6 digit palindromes are multiples of 11 [...]
That's what I was waiting for.
05-04-2015 08:51 PM
I'm noticing some weird stuff depending on how I benchmark. If I stick it all in a for loop I can hit ~2 ns/ itteration. To be fair, I'm only doing 256 palindrome checks in my search (everything else gets filtered out).