Sometimes 100 lines of code can fix your ctfe perf

Ali Çehreli acehreli at yahoo.com
Tue Aug 24 16:52:30 UTC 2021


On 8/24/21 9:06 AM, Stefan Koch wrote:

 > The reason why the string builder had so a flat performance curve was A
 > BUG.

I suspected that as soon as saw your initial post. :) Happens to me too.

 > results for CTFE;

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);

Not that I will change my style but I always wonder how it compares to 
the following horrible one. :)

   string s;
   s ~= "hello ";
   s ~= a;        // Let's assume 'a' and 'b' are strings
   s ~= " world ";
   s ~= b;

Thank you,
Ali



More information about the Digitalmars-d mailing list