[fpc-devel] Suggestion: reference counted objects

Michael Schnell mschnell at lumino.de
Mon Sep 22 11:21:42 CEST 2014


On 09/22/2014 11:13 AM, Sven Barth wrote:
>
> Interfaces, strings and arrays already work well in multi threaded 
> contexts and ARC will use the same mechanisms here, so there is no 
> need to discuss "parallel" and ARC together.
>
Yep. it will work.

But one point speaking against ARC is performance possible degradation, 
This of course is critical when trying to improve performance by using 
multiple cores in parallel. As the ref counting needs atomic operation, 
this is especially critical, because same are even more expensive when 
the variables are accessed by multiple cores (and hence reside in 
multiple caches).

OTOH ARC might be "interesting" (but supposedly not really advantageous) 
with parallel processing for creating thread-local objects in certain 
cases.

> Note: ARC doesn't change that the developer him-/herself needs to make 
> his/her classes threadsafe. ARC only "protects" the references.
>
Adding even more confusion to developing multithreaded projects :-( .

-Michael




More information about the fpc-devel mailing list