On May 31, 2008, at 12:16 AM, Norman Palardy wrote:
> On 30-May-08, at 7:50 PM, Karen wrote:
>
>> But these days variants can store arrays so I thought why not store a
>> two element variant array in the CellTag for column 0 instead of
>> using a dictionary or an object. That MIGHT both be faster and more
>> memory efficient that either of the above solutions... What do you
>> think? What type of situation would this be better or worst for?
>>
> if you always make a 2 member array you always allocate room for a
> rowtag whether you need it or not
> the dictionary didn't
True, but with the code I posted that is true only if one actually
stores a RowTag or column 0 Celltag for that row, so in that sense it
is like the dictionary solution. However storing one does reserve
space for both as well as the array reference.
But it would seem me that dictionary would have to store 2 variants
(key and the value) so that negates that advantage. And if you store
both a RowTag and and a CellTag that would be 4 variants stored for
that row vs 2 with an array.
A 2 member variant array with no data would take up 4 bytes for the
array reference + 8 bytes for the variant references + the space for
whatever extra internal data structures variants and arrays have.
What type of memory overhead does a dictionary have for it's base
internal data structures and per item stored as compared to array
overhead?
In this case using a dictionary is probably slower for access so the
only reason to use it would be if it is more memory efficient.
In an absolute sense with a large enough number of entries a
dictionary would always EVENTUALLY win IF it's per item overhead was
lower for storing 2 values than whatever the array overhead was. If
the per item overhead for the dictionary was less than the array
overhead but more than 1/2 of it then it depends on how often you
have have both a RowTag and column 0 cell tag on the same row. If
that overhead was more than the array overhead the the array is the
clear winner
And of course what that number of entries was would depend on the
base overhead of the 2 dictionaries.
Unfortunately users don't have all that info and would have to try
and figure it out empirically...
Does anyone have feel for these numbers?
Thanks,
- Karen
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|