[fpc-pascal] Generics vs templates
mailinglists at geldenhuys.co.uk
Mon Jan 8 21:30:31 CET 2018
On 2018-01-08 10:58, Sven Barth via fpc-pascal wrote:
> FPC essentially reparses a generic during specialization so I'd say that
> they definitely affect compile times. However we're still only doing a
> single pass of parsing. This while the compilation might be slower it might
> not be as bad as with a C++ compiler.
> As far as I know no one has done a benchmark for that however.
Speaking of Generics and Benchmarks. Has anybody done some benchmarks on
FPC's Generics vs "old-school" TList and TObjectList. Recently I did a
very simple test with Delphi XE3 using TList<Integer> and a stock TList.
Adding 50,000 and 200,000 integer values to each list, and timing the
creation of the list and population of the list. Then I also timed the
destruction of the list. I was horified to find out how much slower
Delphi's Generics were compared to TList and TObjectList. Destruction
was 250x slower in many cases. Creation and population of the list was
Lets hope FPC fares better. If nobody has done such tests, I can do it
tomorrow at work with the same Delphi test code I created.
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
My public PGP key: http://tinyurl.com/graeme-pgp
More information about the fpc-pascal