Swift does away with pointers == pervasive ARC

Kapps via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 17 14:51:17 PDT 2014


On Tuesday, 17 June 2014 at 18:15:24 UTC, Walter Bright wrote:
> On 6/17/2014 4:36 AM, Manu via Digitalmars-d wrote:
>> On 17 June 2014 18:18, Walter Bright via Digitalmars-d
>> <digitalmars-d at puremagic.com> wrote:
>>> On 6/16/2014 10:02 PM, Manu via Digitalmars-d wrote:
>>>
>>>> I can't imagine exceptions would appear in hot code very 
>>>> often/ever?
>>>
>>>
>>> I've tried to explain this to you for months. You don't 
>>> believe my
>>> explanations, we just go round in circles. I strongly suggest 
>>> you write some
>>> code with shared_ptr<T> and try it out. Disassemble the 
>>> result. Benchmark
>>> it. Use Microsoft C++, so I won't be sabotaging your results 
>>> and it won't be
>>> because I write crappy compilers :-)
>>
>> ARC is useless without compiler support.
>
> It is not possible to understand the tradeoffs with ARC without 
> understanding the cost of the DEC.

Is there a way to move the costs of exception handling to occur
only if an exception is actually encountered? Perhaps something
similar to the mark & sweep for a garbage collection that can
update reference counts? The idea being that code that cares
enough about lack of pauses is not generally going to be throwing
exceptions in the first place (though may not necessarily be able
to be nothrow due to rare circumstances).

I'm guessing there's also no way to actually estimate what sort
of performance hit ARC would bring? Even something like a 20%
performance hit in functions that are not specifically optimized
for it would be reasonable if it comes at the benefit of lack of
pauses.


More information about the Digitalmars-d mailing list