Re: [fpc-pascal] Generics vs templates

2018-01-11 Thread Sven Barth via fpc-pascal
Am 11.01.2018 08:06 schrieb "Michael Schnell" : On 09.01.2018 08:04, Sven Barth via fpc-pascal 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. Seemingly it is done that way.

Re: [fpc-pascal] Generics vs templates

2018-01-10 Thread Michael Schnell
On 09.01.2018 08:04, Sven Barth via fpc-pascal 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. Seemingly it is done that way. I rather often did a kind of "Generics" in ANSI C by using Macros.

Re: [fpc-pascal] Generics vs templates

2018-01-09 Thread Sven Barth via fpc-pascal
Am 10.01.2018 05:10 schrieb "Ryan Joseph" : > On Jan 10, 2018, at 6:37 AM, Graeme Geldenhuys < mailingli...@geldenhuys.co.uk> wrote: > > When using the Generics.Collections unit of Delphi I can define a list class that can hold Integer data types, by doing the

Re: [fpc-pascal] Generics vs templates

2018-01-09 Thread Sven Barth via fpc-pascal
Am 10.01.2018 07:39 schrieb "Marco van de Voort" : In our previous episode, Sven Barth via fpc-pascal said: > 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.

Re: [fpc-pascal] Generics vs templates

2018-01-09 Thread Marco van de Voort
In our previous episode, Sven Barth via fpc-pascal said: > 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

Re: [fpc-pascal] Generics vs templates

2018-01-09 Thread Ryan Joseph
> On Jan 10, 2018, at 6:37 AM, Graeme Geldenhuys > wrote: > > When using the Generics.Collections unit of Delphi I can define a list class > that can hold Integer data types, by doing the following: > > var >IntList: TList; > begin >IntList :=

Re: [fpc-pascal] Generics vs templates

2018-01-09 Thread Graeme Geldenhuys
On 2018-01-09 01:29, Ryan Joseph wrote: What does this have to do with generics exactly? Everything I guess. ;-) That was the point of my reply. When using the Generics.Collections unit of Delphi I can define a list class that can hold Integer data types, by doing the following: var

Re: [fpc-pascal] Generics vs templates

2018-01-09 Thread Maciej Izak
2018-01-08 21:30 GMT+01:00 Graeme Geldenhuys : > 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 and a stock TList.

Re: [fpc-pascal] Generics vs templates

2018-01-09 Thread Sven Barth via fpc-pascal
Am 09.01.2018 08:13 schrieb "Ryan Joseph" : > On Jan 9, 2018, at 2:04 PM, Sven Barth via fpc-pascal < fpc-pascal@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

Re: [fpc-pascal] Generics vs templates

2018-01-08 Thread Sven Barth via fpc-pascal
Am 09.01.2018 02:59 schrieb "Ryan Joseph" : > On Jan 9, 2018, at 3:30 AM, Graeme Geldenhuys < mailingli...@geldenhuys.co.uk> wrote: > > Recently I did a very simple test with Delphi XE3 using TList and a stock TList. Adding 50,000 and 200,000 integer values to each

Re: [fpc-pascal] Generics vs templates

2018-01-08 Thread Giuliano Colla
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

Re: [fpc-pascal] Generics vs templates

2018-01-08 Thread Sven Barth via fpc-pascal
Am 08.01.2018 12:52 schrieb "Ryan Joseph" : > On Jan 8, 2018, at 5:58 PM, Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > > FPC essentially reparses a generic during specialization so I'd say that they definitely affect compile times. Does c++

Re: [fpc-pascal] Generics vs templates

2018-01-08 Thread Ryan Joseph
> On Jan 8, 2018, at 5:58 PM, Sven Barth via fpc-pascal > wrote: > > FPC essentially reparses a generic during specialization so I'd say that they > definitely affect compile times. Does c++ not “specialize” in one location like FPC? looking at c++ code I

Re: [fpc-pascal] Generics vs templates

2018-01-08 Thread Sven Barth via fpc-pascal
Am 08.01.2018 08:50 schrieb "Ryan Joseph" : I was talking with a c++ developer who explained how templates are implemented in c++ and how use some recursive method which causes them to totally murder compile times. This isn’t the first I’ve heard of the problem though

[fpc-pascal] Generics vs templates

2018-01-07 Thread Ryan Joseph
I was talking with a c++ developer who explained how templates are implemented in c++ and how use some recursive method which causes them to totally murder compile times. This isn’t the first I’ve heard of the problem though and I recall some game studios who develop engines in c++ saying they