[fpc-pascal] Generics vs templates

Giuliano Colla giuliano.colla at fastwebnet.it
Tue Jan 9 00:58:54 CET 2018

Il 08/01/2018 21:30, Graeme Geldenhuys ha scritto:

> I was horified to find out how much slower Delphi's Generics were 
> compared to TList and TObjectList

I don't expect FPC behave much better. Whenever you move something from 
compile time to execution time you may gain in flexibility, but you 
surely lose in performance. Whenever a generic can be replaced by an if 
.. then .. else .., using a generic is just an useless performance killer.
The same holds true for using a TObject, when a record would be enough 
or for using an Interface instead of just linking the appropriate 
library when this would be possible (see Lazarus vs fpGui!).


More information about the fpc-pascal mailing list