- DelphiTools - https://www.delphitools.info -

Performance issue in NextGen ARC model

traffic_jam

Weak references and their zeroing is managed in Delphi NextGen through a global hash table, with a global lock, see Arnaud Bouchez take on it:

Performance-issue-in-NextGen-ARC-model [1]

Also apart from the global locking which itself is bad enough, there are a couple further performance issues:

There are several ways around that situation, the first is to maintain a list per-class, as is done in mORMot [2], which will spread the locking and reduce the list maintenance overhead. Another way around is to do away with weak references entirely and collect reference cycles with a dedicated GC [3], which is what Python does [4], and what DWScript does [5] (more modestly) as well. This has the benefit of removing the error-prone weak reference qualification from the code, without incurring the stalls a full GC has (see wikipedia article [3] links) and is concurrency-friendly.