optimatization suggestion

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 1 15:48:08 PDT 2017


Inquie wrote:

> I use a lot of code that has string appending and it seems like it could 
> be optimized;
>
> wchar[] x;
>
> x ~= "This is one line";
> x ~= "This is another line";
>
> could become
>
> x ~= "This is one lineThis is another line";

the problem with "smal optimizations" is that they adds complexity to the 
compiler for a very small win in a very specific cases. here, the overall 
win is almost nonexistant, but compiler devs should add another specific 
data flow analysis stage.

it may *look* like a trivial piece of code, but it actually not so simple, 
and such "trivial" hacks tend to accumulate, burdening the code base.


More information about the Digitalmars-d mailing list