[squeak-dev] SparseLargeTable
Yoshiki Ohshima
yoshiki at vpri.org
Sat Nov 1 21:49:40 UTC 2008
At Sat, 1 Nov 2008 12:12:21 -0700,
Eliot Miranda wrote:
>
> [1 <multipart/alternative (7bit)>]
> [1.1 <text/plain; ISO-8859-1 (7bit)>]
>
> [1.2 <text/html; ISO-8859-1 (7bit)>]
> Hi All,
>
> SparseLargeTable appears not to be sparse at all. If you look at SparseLargeTable>>
> initChunkSize:size:arrayClass:base:defaultValue: you'll see tat each bin is initialized with an instance of the base
> class rather than being filled lazily. Further, instead of pvtNoCheckAt:put: lazily creating an entry in each bin as
> needed it simply throws away the write if the bin is empty. Instead the usage pattern is to create fully-populated
> instances and then make them sparse by sending zapDefaultOnlyEntries.
Correct. As you saw, it is designed for the usage pattern of
creating a read-only table once.
> It seems to me that SparseLargeTable>>initChunkSize:size:arrayClass:base:defaultValue: should leave bins empty
> until pvtNoCheckAt:put: puts other than the default value. Since I want to create a sparse table with 2^32 entries the
> existing approach won't work.
Ah ha.
> I wondered whether anyone else had already fixed this or whether there's a good reason not to lazily initialize.
I'm not aware of anybody who fixed. Well, if you need to hold 2^32
entries, you should do whatever it takes and doing the lazy
initialization seems to be good...
-- Yoshiki
More information about the Squeak-dev
mailing list
|