[fpc-pascal] [PATCH] Addition of OnNotify event on "TFPGObjectList" and "TFPGList" triggered on the insert, delete and extract methods.
Michael Van Canneyt
michael at freepascal.org
Sat Feb 20 11:10:02 CET 2016
On Sat, 20 Feb 2016, Michalis Kamburelis wrote:
>>> Can you send little bit sample showing this degradation? I can inform him
>>> to not send the patch because this problem. (I think that him isn't
>>> registered here in the list yet)
>>
>> There's no need for a sample. This degradation is the whole reason why the
>> non-generic classes TFPObjectList and TFPList exist compared to TObjectList
>> and TList which do have notifications.
>
> Hm, two points.
>
> 1. I'm using FGL containers a lot (because I like type-safety given by
> generics), and I agree that adding a notification mechanism there can
> slow them down. Mostly at allocation (because a deallocation is
> already burdened down by having to do Deref() on every item, so it
> would probably not suffer *so much* with unassigned OnNotify).
>
> 2. But this should not stop us from making a "generic container with
> notification" classes. Maybe as new classes, maybe as a boolean toggle
> to existing classes (as Graeme nicely suggests).
>
> Right now we only have "with notifications, and not type-safe"
> containers (TObjectList/TList) and "without notifications, and
> type-safe using generics" containers (TFPObjectList/TFPList).
These latter 2 are not generics based. There was some experimental code
which attempted to implement TFPObjectList/TFPList on top of generics,
but they were slower than the native implementation. That experiment is
unmaintained.
TFPGList is the one you meant, probably.
Michael.
More information about the fpc-pascal
mailing list