Escaping the Tyranny of the GC: std.rcstring, first blood

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 24 13:22:05 PDT 2014


On 9/24/14, 12:49 PM, "Nordlöw" wrote:
> On Wednesday, 24 September 2014 at 14:58:34 UTC, Andrei Alexandrescu wrote:
>>> I didn't test speed.
>
> So the pro must be (de)allocation speed then, I suppose?

The pro is twofold:

1. Code using RC will be more compact about using memory if strings are 
created and then discarded. Depending on a variety of factors, that may 
lead to better cache friendliness.

2. If a GC cycle will occur, that will add to the total run time of GC 
code, meaning RC code will gain an advantage.

Code that doesn't create/discard a lot of strings and doesn't get to run 
the GC is likely to be slower with RCString.


Andrei



More information about the Digitalmars-d mailing list