Sanely optimized fizzbuzz

Elronnd elronnd at elronnd.net
Sat Oct 30 09:51:43 UTC 2021


On Saturday, 30 October 2021 at 07:30:26 UTC, Brian Callahan 
wrote:
> On my very slow machine, the naive solution in C that you 
> linked to runs at around 64.5 MB/s.
>
> An equally naive version in D runs on the same machine at 
> around 920 MB/s:
> [...]

That's doing something completely different.  C is generating 
_all_ fizzbuzz values up to (some very large number), and 
printing them out once.  Your code is generating all the fizzbuzz 
values up to (some rather small number), and then printing them 
out over and over again; effectively a benchmark of i/o.


More information about the Digitalmars-d mailing list