iPhone vs Android

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 13 11:24:26 PDT 2016


On Tuesday, 13 September 2016 at 11:59:46 UTC, Shachar Shemesh 
wrote:
> On 13/09/16 02:21, deadalnix wrote:
>>
>> RC itself is not panacea, it doesn't work well with 
>> exceptions, generate
>> a huge amount of code bloat,
>
> I will need explanation to those two. Assuming we have RAII, 
> why doesn't RC work well with exceptions?
>

With RC, the runtime needs to resume every frames. That makes 
exception very slow. Plus you need to generate a bunch of 
unwinding code + LSDA infos, and it clusters like crazy when you 
have destructor that can throw.

This is why ObjC exeption handling and ARC never worked well 
together. This is why C++ exception are dog slow and this is why 
Swift is nothrow by default.

>> But first and foremost, it is a disaster for shared data.
>
> Again, please elaborate.
>

For shared data, you need synchronized reference counting, which 
is prohibitively expensive.

> Here's my worries about the hybrid approach. The GC run time is 
> proportional not to the amount of memory you manage with the 
> GC, but to the amount of memory that might hold a pointer to a 
> GC managed memory. In other words, if most of my memory is RC 
> managed, but some of it is GC, I pay the price of both memory 
> manager on most of my memory.
>
> Shachar

No you don't, as how often the GC kicks in depend of the rate at 
which you produce garbage, which is going to be very low with an 
hybrid approach.



More information about the Digitalmars-d mailing list