The main issue is that XE4 RTL implements weak references with a global lock, which will slow down the whole process a lot, especially in multi-thread.
procedure TInstHashMap.RegisterWeakRef(Address: Pointer; Instance: Pointer);
H := Hash(Instance);
Item := FindInstItem(Instance, H);
if Item = nil then
Item := AddInstItem(Instance, H);
Lock/Unlock methods are implemented via
This synchronization class has the benefit to be cross-platform, but the drawback of being slower than other approaches.
Such a global lock will just kill the performance in multi-thread process.
Our weak pointer implementation for interfaces in mORMot uses a diverse approach, with a list per class type and small critical sections, so will be much more multi-thread friendly than XE4's implementation.
We can use ARC when targeting mobile platforms.
But in its current implementation, ARC would be a disaster about performance for a server application.
I'm waiting for XE5!
Please do not kill Delphi desktop/server application performance!
In October last year
we were already speaking about this global lock implementation issue, when
we discovered a pre-version of it in the XE3 RTL source code.
And the version shipped with XE4 did not improve anything.
How could EMB say that performance is a concern for them?
The more I see it, the more I think that enforcing strings to be immutable for performance reasons is just a joke, when you look at the current RTL state.