www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Is all this Invarient **** er... stuff, premature optimisation?

 So, that's two copies of the string, plus a slice, plus an extra method call
to 
 achieve what used to be achievable in place on the original string. Which is
now 
 immutable, but I'll never need it again. 

this is what string functions look like.
 Of course, on these short 1-off strings it doesn't matter a hoot. But when the 
 strings are 200 to 500 characters a pop and there are 20,000,000 of them. It 
 matters.

In this case you may need a StringBuilder
 And give us usable libraries and sensible implicit conversions. Cos this sucks 
 bigtime.

I think one should first use safe methods at the cost of performance and memory usage, if this proves to suck, one should switch to an advanced technique at the cost of expressiveness and developer's care.
Apr 28 2008