On Tuesday, 9 November 2021 at 11:03:09 UTC, forkit wrote:

They both produce exactly the same output.

But do vastly different things.

But I tell ya.. the cognitive load .. well.. it increased dramatically ;-)

Of course it did. Cuz you overthunk it. Dramatically.

Your D version allocates memory, for no good reason. I mean, to store results, but you already have storage for them, so kinda pointless. Your C version, OTOH, stores results on stack (so again, why did you allocate for them in D?..), but allocates some "string builder" for... what, exactly?

The program is filter, or sort + partition. Requires 0 allocations in C or D.

Reply via email to