3 ms·
Sure it is: https://codegolf.stackexchange.com/questions/215216/high-throughput-fizz-buzz/236737#236737 https://codegolf.stackexchange.com/questions/215216/high
by bonzini 5y ago
Sure it is: https://codegolf.stackexchange.com/questions/215216/high-throughput-fizz-buzz/236737#236737 https://codegolf.stackexchange.com/questions/215216/high-thr...
It executes just one (well predicted) branch every 30 numbers written, and incrementing/printing the line number is branchless too.
It's not as fast as the subject of the post (40 GB/s) but it's only a few hours of work.
- saagarjha 5y agoThe parent comment asserted that FizzBuzz should never branch. This would require it to not have any backwards control flow, and thus require full unrolling of an infinite sequence. Hence the infeasibility.
- brudgers 5y agoFizzBuzz is limited to [1…100]. Output as an ASCII string, it is fewer than 400 bytes including \n’s. If you’re counting GB/S, you’ve failed to understand the specification. One of the sophisticated engineering aspects of FizzBuzz is that all optimizations are premature. It is a boring problem. People being people invent different problems to provide a chance to be clever.
- bonzini 5y agoI interpreted that as no branches, only loops.