Want reasonable reference counting? Disable automatic sharing of immutable

claptrap clap at trap.com
Mon Nov 15 14:39:11 UTC 2021


On Monday, 15 November 2021 at 09:22:16 UTC, Dukc wrote:
> On Monday, 15 November 2021 at 08:38:07 UTC, Ola Fosheim 
> Grøstad wrote:
>> On Monday, 15 November 2021 at 07:14:12 UTC, Walter Bright 
>> wrote:
>>> On 11/14/2021 12:04 PM, H. S. Teoh
>
> I think he meant from optimisation viewpoint. C++ `const` is so 
> weak that it can't be used for actual optimisations anyway, at 
> least usually. So no performance is lost because of `mutable`. 
> In D the compiler can make some assumption based on `const` and 
> `immutable`, so we lose some performance potential if we 
> implement `mutable`.

Theres a talk on youtube by Chandler Carruth about llvm / clang 
optimisation and he says const is litteraly of no use at all.


More information about the Digitalmars-d mailing list