[fpc-pascal] Generics vs templates

Sven Barth pascaldragon at googlemail.com
Tue Jan 9 10:41:00 CET 2018


Am 09.01.2018 08:13 schrieb "Ryan Joseph" <ryan at thealchemistguild.com>:



> On Jan 9, 2018, at 2:04 PM, Sven Barth via fpc-pascal <
fpc-pascal at lists.freepascal.org> wrote:
>
> But you need to program in a way that allows the usage of multiple,
different types. That can more often than not lead to worse performance.
>

Examples? I had to add some if statements in a couple areas I didn’t want
to and a virtual method but beyond that I don’t see what would affect
performance.


Precisely these virtual methods are one point. They might not add much by
themselves, but if they're called for each Add or Remove operation they can
add quite a bit.
Why do you think that the TFP(Object)List classes don't have notification
support unlike T(Object)List? Even if it only checks whether a notification
handler is assigned it's enough for a noticeable difference in performance.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180109/a9a5b4e5/attachment.html>


More information about the fpc-pascal mailing list