Michael Lazzaro wrote:

I have some answers from current low level implementation.

2) As hinted above, is there a (platform-dependent) maximum addressable array index, or do we promise to correctly handle all integers, even if BigInt? (This might come into play for lazy/sparse arrays. Maybe.)

new P0, .PerlArray
set I0, 1
shl I0, I0, 31
dec I0
dec I0
set P0[I0], I0
set I1, P0[I0]
print I1
print "\n"
end

Current max index is 2^31-2 (for 32bitters). SIZE/RSS of above running is 1152 (list.c can do sparse arrays). IMHO for bigger arrays use a 64 bit processor, and you can't fill them anyway ;-)


4) Optional array behavior. In addition to default values, it may be possible to expose other details of array behavior, such that the user has some flexibility in the implementation of a given array. Examples:

my @a is Array(
min_size => 50, # minimum reported size of this array

Just set @a[49]


        resize => (1024),      # internal blocksize (in indexes)

items per chunk, yes.


                               # by which array expands?
        resize => { $_ * 2 },  # or via closure, based on current size?

Small arrays start extending by doubling chunk sizes, big arrays start with maximum chunk sizes and don't grow chunks anymore. Closures or such are for sure overkill and will slow it down.


        exception => 1,        # whether out-of-bounds addressing

This is default for Array.pm (PerlArray does auto resize).


MikeL

leo

Reply via email to