gsharma84 wrote:thanks ! but would this 'AbtHighCapacityLookupTable' work the same way as LookupTable use to work for a smaller table. My concern is the performance for LookupTable with lesser entries, hope that would not be degraded...
AbtHighCapacityLookupTable is somewhat slower than LookupTable, because abtHash32 is generally slower than hash. Of course the difference depends greatly on what you are hashing. Here's an example using reltively short strings for keys and doing five million lookups on both types of lookup tables with five hundred entries. The following code:
- Code: Select all
|tbl bigtbl rand keys|
tbl := LookupTable new: 200.
bigtbl := AbtHighCapacityLookupTable new: 200.
rand := EsRandom new.
500 timesRepeat:
[|r|
r := rand next.
tbl at: r printString put: r.
bigtbl at: r printString put: r].
keys := tbl keys.
Transcript cr.
Transcript show: (Time millisecondsToRun:
[10000 timesRepeat: [keys do: [:each | tbl at: each]]]) printString.
Transcript cr.
Transcript show: (Time millisecondsToRun:
[10000 timesRepeat: [keys do: [:each | bigtbl at: each]]]) printString.
runs right around 2.5 seconds for the LookupTable and 3.1 seconds for the AbtHighCapacityLookupTable on my relatively old laptop.
I always use AbtHighCapacityLookupTable if my table will exceed about 12000 entries.
Doug swartz