Sometimes 100 lines of code can fix your ctfe perf

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Tue Aug 24 19:35:39 UTC 2021


On Tuesday, 24 August 2021 at 16:58:26 UTC, Adam D Ruppe wrote:
> On Tuesday, 24 August 2021 at 16:52:30 UTC, Ali Çehreli wrote:
>> I know it's not the same use case but I've standardized on the 
>> following style for string formatting both for CTFE and run 
>> time:
>>
>>   auto s = format!"hello %s world %s"(a, b);
>
> yikes that's like the worst thing in the whole D world. 
> brutally slow by all metrics.

Best here from use point of view is text method for simple use 
cases:

text("Hello ", a, " world ", b);

Hope it is better on perf at ctfe than format.

Regards,
Alexandru.


More information about the Digitalmars-d mailing list