Re: [fpc-pascal] IntList
Am 04.11.2010 14:59, schrieb Marco van de Voort: > In our previous episode, Florian Klaempfl said: >>> Sorry, >>> >>> This was meant to be a private message. >>> >>> For those interested: the idea is to have a standard set of generics >>> definitions that implement some commonly-used templates. A kind of STL >>> in pascal. >> >> You are aware of the fgl unit in the rtl? It is supposed to be something >> like this. > > The fgl unit seems more targeted at implementing base Delphi types (which > all map to arrays) using generics. Currently yes, but it was supposed to contain more types (Micha didn't continue ;)). ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntList
In our previous episode, Florian Klaempfl said: > > Sorry, > > > > This was meant to be a private message. > > > > For those interested: the idea is to have a standard set of generics > > definitions that implement some commonly-used templates. A kind of STL > > in pascal. > > You are aware of the fgl unit in the rtl? It is supposed to be something > like this. The fgl unit seems more targeted at implementing base Delphi types (which all map to arrays) using generics. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntList
Am 04.11.2010 13:23, schrieb Michael Van Canneyt: > > Sorry, > > This was meant to be a private message. > > For those interested: the idea is to have a standard set of generics > definitions that implement some commonly-used templates. A kind of STL > in pascal. You are aware of the fgl unit in the rtl? It is supposed to be something like this. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntList
Sorry, This was meant to be a private message. For those interested: the idea is to have a standard set of generics definitions that implement some commonly-used templates. A kind of STL in pascal. Michael. On Thu, 4 Nov 2010, Michael Van Canneyt wrote: Hi, I asked around. We'd like to propose the following: - We import the code in the FPC subversion repository, in a package. - You get read/write access to the package, so you can maintain it. Subject to 2 conditions: - You use the FPC license. - Please remove all _ characters at the start of identifiers. This goes against our coding rules. (we try to avoid _ as much as possible) If you can agree with this, I'll import the code in the FPC repository. Michael. On Wed, 3 Nov 2010, Vlado Boza wrote: On 10/19/2010 08:28 PM, Michael Van Canneyt wrote: On Tue, 19 Oct 2010, Sven Barth wrote: Am 19.10.2010 19:54, schrieb Juha Manninen (gmail): On Tuesday 19 October 2010 19:10:39 Luiz Americo Pereira Camara wrote: Yes it's ready in fpc 240: uses Fgl; type TIntegerList = specialize TFPGList; Well, yes. It is almost as good as a dedicated class. It has a Sort method but you must feed the compare function for it. It does not have a Find method for a binary search in a sorted list. Indexof does a linear search. Anyway, it could be used as a base class in Lazarus. I don't know what is the Lazarus team's policy for using generics in Lazarus code-base. In FPC 2.4.0 I had problems with memory consumption of generics containers. A map hogged gigabytes of memory while my data took only kilobytes (less than 1 MB for sure), on a 64 bit Linux. Now I have the latest FPC trunk 2.5.1 and the problems are gone. I added 10 integers to both a List and to a Map and didn't even notice the memory increase in resource monitor. TIntegerList = specialize TFPGList; TIntegerMap = specialize TFPGMap; TFPGMap's problem still is that it is not a hash map and is butt-slow with lots of data. A hash map is a superior container type, it really should be changed. Besides, people expect to get a hash map when they see "map" in the class name. Now they get a list which is deceivingly named as "map". As you seem to have experience with efficient data structures, what about creating such a generic hash map? :) (but don't use 2.4.2rc1 and current/unpatched 2.4.3 as a test base as those don't have the fixes from trunk to make "specialize" working again) Currently, the FPC team is looking at an implementation of Vlado Boza for a standard template library for inclusion in FPC. The code is on http://code.google.com/p/stlpascal Please have a look and comment on it. I'm not a generics expert and am not in the position to judge whether this library is good or not. Michael. Hash_map implementation shouldn't be a big problem. But I also think, that other structures can be usefull as well (for example in map done by red-black tree you can find greatest key which less than X in a good time, ...). A is there any decision if it is worth to put it in FPC and where to put it? Vlad. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntList
Hi, I asked around. We'd like to propose the following: - We import the code in the FPC subversion repository, in a package. - You get read/write access to the package, so you can maintain it. Subject to 2 conditions: - You use the FPC license. - Please remove all _ characters at the start of identifiers. This goes against our coding rules. (we try to avoid _ as much as possible) If you can agree with this, I'll import the code in the FPC repository. Michael. On Wed, 3 Nov 2010, Vlado Boza wrote: On 10/19/2010 08:28 PM, Michael Van Canneyt wrote: On Tue, 19 Oct 2010, Sven Barth wrote: Am 19.10.2010 19:54, schrieb Juha Manninen (gmail): On Tuesday 19 October 2010 19:10:39 Luiz Americo Pereira Camara wrote: Yes it's ready in fpc 240: uses Fgl; type TIntegerList = specialize TFPGList; Well, yes. It is almost as good as a dedicated class. It has a Sort method but you must feed the compare function for it. It does not have a Find method for a binary search in a sorted list. Indexof does a linear search. Anyway, it could be used as a base class in Lazarus. I don't know what is the Lazarus team's policy for using generics in Lazarus code-base. In FPC 2.4.0 I had problems with memory consumption of generics containers. A map hogged gigabytes of memory while my data took only kilobytes (less than 1 MB for sure), on a 64 bit Linux. Now I have the latest FPC trunk 2.5.1 and the problems are gone. I added 10 integers to both a List and to a Map and didn't even notice the memory increase in resource monitor. TIntegerList = specialize TFPGList; TIntegerMap = specialize TFPGMap; TFPGMap's problem still is that it is not a hash map and is butt-slow with lots of data. A hash map is a superior container type, it really should be changed. Besides, people expect to get a hash map when they see "map" in the class name. Now they get a list which is deceivingly named as "map". As you seem to have experience with efficient data structures, what about creating such a generic hash map? :) (but don't use 2.4.2rc1 and current/unpatched 2.4.3 as a test base as those don't have the fixes from trunk to make "specialize" working again) Currently, the FPC team is looking at an implementation of Vlado Boza for a standard template library for inclusion in FPC. The code is on http://code.google.com/p/stlpascal Please have a look and comment on it. I'm not a generics expert and am not in the position to judge whether this library is good or not. Michael. Hash_map implementation shouldn't be a big problem. But I also think, that other structures can be usefull as well (for example in map done by red-black tree you can find greatest key which less than X in a good time, ...). A is there any decision if it is worth to put it in FPC and where to put it? Vlad. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntList
On Wed, 3 Nov 2010, Vlado Boza wrote: On 10/19/2010 08:28 PM, Michael Van Canneyt wrote: [snip] The code is on http://code.google.com/p/stlpascal Please have a look and comment on it. I'm not a generics expert and am not in the position to judge whether this library is good or not. Michael. Hash_map implementation shouldn't be a big problem. But I also think, that other structures can be usefull as well (for example in map done by red-black tree you can find greatest key which less than X in a good time, ...). A is there any decision if it is worth to put it in FPC and where to put it? There is no decision yet. I will ask again and get back to you. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntList
On 10/19/2010 08:28 PM, Michael Van Canneyt wrote: On Tue, 19 Oct 2010, Sven Barth wrote: Am 19.10.2010 19:54, schrieb Juha Manninen (gmail): On Tuesday 19 October 2010 19:10:39 Luiz Americo Pereira Camara wrote: Yes it's ready in fpc 240: uses Fgl; type TIntegerList = specialize TFPGList; Well, yes. It is almost as good as a dedicated class. It has a Sort method but you must feed the compare function for it. It does not have a Find method for a binary search in a sorted list. Indexof does a linear search. Anyway, it could be used as a base class in Lazarus. I don't know what is the Lazarus team's policy for using generics in Lazarus code-base. In FPC 2.4.0 I had problems with memory consumption of generics containers. A map hogged gigabytes of memory while my data took only kilobytes (less than 1 MB for sure), on a 64 bit Linux. Now I have the latest FPC trunk 2.5.1 and the problems are gone. I added 10 integers to both a List and to a Map and didn't even notice the memory increase in resource monitor. TIntegerList = specialize TFPGList; TIntegerMap = specialize TFPGMap; TFPGMap's problem still is that it is not a hash map and is butt-slow with lots of data. A hash map is a superior container type, it really should be changed. Besides, people expect to get a hash map when they see "map" in the class name. Now they get a list which is deceivingly named as "map". As you seem to have experience with efficient data structures, what about creating such a generic hash map? :) (but don't use 2.4.2rc1 and current/unpatched 2.4.3 as a test base as those don't have the fixes from trunk to make "specialize" working again) Currently, the FPC team is looking at an implementation of Vlado Boza for a standard template library for inclusion in FPC. The code is on http://code.google.com/p/stlpascal Please have a look and comment on it. I'm not a generics expert and am not in the position to judge whether this library is good or not. Michael. Hash_map implementation shouldn't be a big problem. But I also think, that other structures can be usefull as well (for example in map done by red-black tree you can find greatest key which less than X in a good time, ...). A is there any decision if it is worth to put it in FPC and where to put it? Vlad. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntList
2010/10/19 Brian Winfrey : > Take a look at http://code.google.com/p/fprb/. I have just perused > it, but it looks pretty good. I'm willing to cooperate (as free time permits) on any required FPRB/heLib review/modification process would any part(s) of the code be considered/adopted by the dev team, including but not limited to (re)releasing the code under a FCL compatible license (currently New BSD). Just let me know if/what is necessary. -- bflm freepascal-bits.blogspot.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntList
Take a look at http://code.google.com/p/fprb/. I have just perused it, but it looks pretty good. Brian. > > Currently, the FPC team is looking at an implementation of Vlado Boza > for a standard template library for inclusion in FPC. > > The code is on > > http://code.google.com/p/stlpascal > > Please have a look and comment on it. > > I'm not a generics expert and am not in the position to judge whether this > library is good or not. > > Michael. > ___ > fpc-pascal maillist - fpc-pas...@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntList
On Tue, 19 Oct 2010, Sven Barth wrote: Am 19.10.2010 19:54, schrieb Juha Manninen (gmail): On Tuesday 19 October 2010 19:10:39 Luiz Americo Pereira Camara wrote: Yes it's ready in fpc 240: uses Fgl; type TIntegerList = specialize TFPGList; Well, yes. It is almost as good as a dedicated class. It has a Sort method but you must feed the compare function for it. It does not have a Find method for a binary search in a sorted list. Indexof does a linear search. Anyway, it could be used as a base class in Lazarus. I don't know what is the Lazarus team's policy for using generics in Lazarus code-base. In FPC 2.4.0 I had problems with memory consumption of generics containers. A map hogged gigabytes of memory while my data took only kilobytes (less than 1 MB for sure), on a 64 bit Linux. Now I have the latest FPC trunk 2.5.1 and the problems are gone. I added 10 integers to both a List and to a Map and didn't even notice the memory increase in resource monitor. TIntegerList = specialize TFPGList; TIntegerMap = specialize TFPGMap; TFPGMap's problem still is that it is not a hash map and is butt-slow with lots of data. A hash map is a superior container type, it really should be changed. Besides, people expect to get a hash map when they see "map" in the class name. Now they get a list which is deceivingly named as "map". As you seem to have experience with efficient data structures, what about creating such a generic hash map? :) (but don't use 2.4.2rc1 and current/unpatched 2.4.3 as a test base as those don't have the fixes from trunk to make "specialize" working again) Currently, the FPC team is looking at an implementation of Vlado Boza for a standard template library for inclusion in FPC. The code is on http://code.google.com/p/stlpascal Please have a look and comment on it. I'm not a generics expert and am not in the position to judge whether this library is good or not. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntList
Am 19.10.2010 19:54, schrieb Juha Manninen (gmail): On Tuesday 19 October 2010 19:10:39 Luiz Americo Pereira Camara wrote: Yes it's ready in fpc 240: uses Fgl; type TIntegerList = specialize TFPGList; Well, yes. It is almost as good as a dedicated class. It has a Sort method but you must feed the compare function for it. It does not have a Find method for a binary search in a sorted list. Indexof does a linear search. Anyway, it could be used as a base class in Lazarus. I don't know what is the Lazarus team's policy for using generics in Lazarus code-base. In FPC 2.4.0 I had problems with memory consumption of generics containers. A map hogged gigabytes of memory while my data took only kilobytes (less than 1 MB for sure), on a 64 bit Linux. Now I have the latest FPC trunk 2.5.1 and the problems are gone. I added 10 integers to both a List and to a Map and didn't even notice the memory increase in resource monitor. TIntegerList = specialize TFPGList; TIntegerMap = specialize TFPGMap; TFPGMap's problem still is that it is not a hash map and is butt-slow with lots of data. A hash map is a superior container type, it really should be changed. Besides, people expect to get a hash map when they see "map" in the class name. Now they get a list which is deceivingly named as "map". As you seem to have experience with efficient data structures, what about creating such a generic hash map? :) (but don't use 2.4.2rc1 and current/unpatched 2.4.3 as a test base as those don't have the fixes from trunk to make "specialize" working again) Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntList
On Tuesday 19 October 2010 19:10:39 Luiz Americo Pereira Camara wrote: > Yes it's ready in fpc 240: > > uses > Fgl; > > type > TIntegerList = specialize TFPGList ; Well, yes. It is almost as good as a dedicated class. It has a Sort method but you must feed the compare function for it. It does not have a Find method for a binary search in a sorted list. Indexof does a linear search. Anyway, it could be used as a base class in Lazarus. I don't know what is the Lazarus team's policy for using generics in Lazarus code-base. In FPC 2.4.0 I had problems with memory consumption of generics containers. A map hogged gigabytes of memory while my data took only kilobytes (less than 1 MB for sure), on a 64 bit Linux. Now I have the latest FPC trunk 2.5.1 and the problems are gone. I added 10 integers to both a List and to a Map and didn't even notice the memory increase in resource monitor. TIntegerList = specialize TFPGList ; TIntegerMap = specialize TFPGMap ; TFPGMap's problem still is that it is not a hash map and is butt-slow with lots of data. A hash map is a superior container type, it really should be changed. Besides, people expect to get a hash map when they see "map" in the class name. Now they get a list which is deceivingly named as "map". Juha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IntList
Juha Manninen (gmail) escreveu: Hi In Lazarus project jcf2 component has an IntList class which is poorly implemented. It depends on integer and pointer being the same size. I will later suggest to replace it. I have a better IntList. See: http://github.com/JuhaManninen/Pascal/blob/master/IntList/intlist.pas It is similar to TStringList except that it works with integers. It is well tested. Question: can this class be added to FCL? Clearly such class is needed sometimes and people must make their own versions of it. Generics can solve it in the future but it is not ready yet. Yes it's ready in fpc 240: uses Fgl; type TIntegerList = specialize TFPGList ; Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal