Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2007-10

FPC hash tables vs hash lists?

7 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

Whats the difference between these??? Don't they do the same thing? And if so, why does FPC duplicate the efforts in the contnrs.pp unit? For the online docs they seem to do the same.

TFPHashList vs TFPDataHashTable
TFPHashObjectList vs TFPObjectHashTable

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 10 lines
Hi, Whats the difference between these??? Don't they do the same thing? And if so, why does FPC duplicate the efforts in the contnrs.pp unit? For the online docs they seem to do the same. TFPHashList vs TFPDataHashTable TFPHashObjectList vs TFPObjectHashTable

One is more extensible as the other. This is also explained in the docs, as far as I remember. If you're just going to use the class as-is, it doesn't really matter which one you use. As with many 'general' classes, it's slightly slower than the special class...

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt
Michael Van Canneyt wrote 10 lines
> > TFPHashList vs TFPDataHashTable > TFPHashObjectList vs TFPObjectHashTable > One is more extensible as the other. This is also explained in the docs, as far as I remember. If you're just going to use the class as-is, it doesn't really matter which one you use. As with many 'general' classes, it's slightly slower than the special class...

So which ones are the more specialized ones? The xxxHashList classes or the xxxHashTable classes?

Table vs List?

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Graeme Geldenhuys
Graeme Geldenhuys wrote 6 lines
So which ones are the more specialized ones? The xxxHashList classes or the xxxHashTable classes? Table vs List?

I read the online docs again. Looking only at the hash classes storing pointers. I still don't understand the difference if any between the TFPHashList and TFPDataHashTable classes?

That's why is said before: List vs Table

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 13 lines
On 24/10/2007, Graeme Geldenhuys wrote: > > So which ones are the more specialized ones? The xxxHashList classes > or the xxxHashTable classes? > > Table vs List? > I read the online docs again. Looking only at the hash classes storing pointers. I still don't understand the difference if any between the TFPHashList and TFPDataHashTable classes? That's why is said before: List vs Table

Functionally, there is no difference...

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt
Michael Van Canneyt wrote 8 lines
> I read the online docs again. Looking only at the hash classes storing > pointers. I still don't understand the difference if any between the > TFPHashList and TFPDataHashTable classes? > > That's why I said before: List vs Table Functionally, there is no difference...

In that case, why have both implementations? Backward compatibility maybe?

I just found it confusing and am sure others would too. I needed a Hash List and thought the contnrs unit would have something. Found both implementations (xxxLists and xxxTables) and then wasn't sure which one to use. I then turned to the documentation, and from that, their functionality also sounded the same.

So now I flipped a coin and started using the xxxTable classes. :-)

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Peter Vreman
to Graeme Geldenhuys: I read the online docs again. Looking only at the hash classes storing pointers. I still…
Show quoted text 13 lines
On 24/10/2007, Graeme Geldenhuys wrote: > > So which ones are the more specialized ones? The xxxHashList classes > or the xxxHashTable classes? > > Table vs List? > I read the online docs again. Looking only at the hash classes storing pointers. I still don't understand the difference if any between the TFPHashList and TFPDataHashTable classes? That's why is said before: List vs Table

The TFPHashList and TFPHashObjectList behave the same as a TFPList/TFPObjectList with the additional feature of an hash on a key and corresponding find functions. The key is limited to a shortstring for speed and memory requirements. I have developed these classes especially for the compiler. But since they were general purpose also included them in the FCL.

Peter

Reply by email