LookupTable working very slow..

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

LookupTable working very slow..

Postby gsharma84 » Tue May 25, 2010 1:22 am

Hi,
I just wanted to enquire, does lookup table has any limitation as to the number of entries it can take and work efficiently?
We use it in one of our apps and the entries in lookup table increase to about 7-8K; when I inspect on the variable holding the lookup table, the image simply clocks.
gsharma84
 
Posts: 16
Joined: Mon Dec 21, 2009 8:20 pm

Re: LookupTable working very slow..

Postby marten » Tue May 25, 2010 2:08 am

This class works with SmallInteger hash values, AbtHighCapacityLookupTable works with 32-Bit hash values .... therefore try to use the latter class.
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: LookupTable working very slow..

Postby gsharma84 » Tue May 25, 2010 2:28 am

thanks ! but would this 'AbtHighCapacityLookupTable' work the same wasy 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...
gsharma84
 
Posts: 16
Joined: Mon Dec 21, 2009 8:20 pm

Re: LookupTable working very slow..

Postby daswartz » Tue May 25, 2010 3:38 am

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
daswartz
 
Posts: 48
Joined: Sat Oct 21, 2006 8:12 am
Location: Omaha, USA

Re: LookupTable working very slow..

Postby gsharma84 » Tue May 25, 2010 10:03 pm

thanks Doug swartz, this is really very helpfull..!!
However, this raises another question, is there any limit beyond which we should use abtHighCapacityLookupTable & not LookupTable? Do we have a parameter for defining when to use a LookupTable & when to an AbtHighCapacityLookupTable?
gsharma84
 
Posts: 16
Joined: Mon Dec 21, 2009 8:20 pm

Re: LookupTable working very slow..

Postby a62754 » Thu Jul 01, 2010 2:06 am

I feel there should be automatic transformation from a lookup table to a high capacity table by smalltalk vm - just like smallints get transformed into integers.
a62754
 
Posts: 18
Joined: Thu Jul 01, 2010 2:03 am

Re: LookupTable working very slow..

Postby gsharma84 » Sat Aug 28, 2010 2:17 am

Hi,
I'm noticing a similar issue with the Dictionary class as well. The entries in the dictionary are about 50K+ and to simply do,
"dictionary keysDo: [ :each| each ]" it takes more than a minute...
gsharma84
 
Posts: 16
Joined: Mon Dec 21, 2009 8:20 pm

Re: LookupTable working very slow..

Postby PhotonDemon » Sun Aug 29, 2010 8:53 am

Hi,

The AbtHighCapacityDictionary for the same reason posted above.

Lou
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou@Keystone-Software.com http://www.Keystone-Software.com
PhotonDemon
[|]
 
Posts: 176
Joined: Thu Dec 20, 2007 1:45 pm


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: No registered users and 1 guest