What's the go with the GC these days?

Neia Neutuladh neia at ikeran.org
Sun Jan 6 07:03:42 UTC 2019


On Sat, 05 Jan 2019 22:17:27 -0800, H. S. Teoh wrote:
> Yeah, Walter's right on the money about copy-on-substring being a big
> performance hit in C/C++, and apparently also C# (caveat: I don't know
> anything about C#).  D's slices really does eliminate a lot of the
> background cost that most people don't normally think about.

Interestingly, Java used to use slicing for substrings. This was changed 
(circa java 7, IIRC). The logic was that you might read in a large string 
and preserve a short substring of it for a long time, and that costs you a 
lot of extra memory.

I mean, you could just call `new String(substring)`, but apparently people 
weren't doing that and were confused at their memory usage.


More information about the Digitalmars-d mailing list