Did you use $hget or $hfind? If with $hfind what kind of matching pattern?
There can be huge differences in speed between the two of them, in favour of $hget.

Also did you use $hget(<table>,item) or $hget(<table>,N).item ?
There is a huge difference between those, in favor of $hget(<table>,item)...

Btw, the reason hash tables are as fast as they are, is not only thanks to the fact that they are stored in RAM. Hidden windows with data containing in them are also stored in mem, but with a lot of data, they will lose in speed for writing and reading against hash tables.

Why? I'll try to explain this in a simplistic way...
Because of the way hash tables work, more specifically their lookup methods. When you pass an item to a hash table in order to look up its data, an algorithm is performed on the item (hashing) which transforms the item into a hash, which is a number that the hash table uses to lookup.
You can imagine a hash table storing its data in multiple "buckets" which all contain data.

However, instead of going through each of those buckets to find our specified data, the hash algorithm uses a more efficient way. Based on the hash retrieved after hashing the item, it will know which bucket to look in, bypassing all other buckets.

THIS is what makes hash tables as fast as they are. Their lookup method is not lineair like is the case for text files, .ini files, even hidden windows with data. When looking up a value in a hidden window which has data on each line, the search for a certain line will be lineair, which means line by line, until the result is found. If the data is in the first lines, obviously the retrieval time will be very fast. However imagine the data being in the middle, or even at the end, of a huge database of let's say 50k lines. That will take a very long time.

Not with hash tables, because as said, they simply know which bucket to look into, and bypass all other buckets, so that they find the result much quicker.

Ok that was a very simplified explanation, but it gets the point accross, without getting too technical.




Gone.