4 ms·
I played with FizzBuzz when this was mentioned here a month ago, focusing on the algorithm not optimizations. I stopped once I could do it in simple code with
by w0mbat 5y ago
I played with FizzBuzz when this was mentioned here a month ago, focusing on the algorithm not optimizations.
I stopped once I could do it in simple code with no math except addition, 15 numbers at a time.
for (int x = 0 ; x < 1000000 ; x+= 15) {
printf("%d\n%d\nfizz\n%d\nbuzz\nfizz\n%d\n%d\nfizz\nbuzz\n%d\nfizz\n%d\n%d\nfizzbuzz\n",
1 + x, 2 + x, 4 + x, 7 + x, 8 + x, 11 + x, 13 + x, 14 + x);
}
That is simple enough and fast enough for me.
- WithinReason 5y agoDid you check what the throughput of this is?
- lovasoa 5y agoThat's around 300MiB/s on my computer.