Divide & Conquer divides, but doesn't conquer

Adam D. Ruppe destructionator at gmail.com
Mon May 25 13:00:59 UTC 2020


On Monday, 25 May 2020 at 06:18:13 UTC, FeepingCreature wrote:
> private enum staticMapHelper(size_t length) = 
> staticMapHelperGen!(length);

lol, also called it staticMapHelper when doing this myself!

Solid result though: 2s, 810MB.

I'm kinda surprised it beat the crap out of my mixin version.

Mine was 3s, 1.2G using a mixin expression (alias staticMap = 
mixin(helper()). Changing it to a mixin declaration (the alias is 
in the mixin, like yours) brought it to 2.2s, 924MB. Interesting. 
And changing the helper from a template to a function gives 
another small win: 2.2s but 906MB.


> static foreach and stringof were used so I didn't have to pull 
> in `format` or `to!string`, which had issues in std.meta.

Yeah, format and to!string are both surprisingly heavy. Just 
using to!string(int) even in runtime stuff has a large hit.



More information about the Digitalmars-d mailing list