Dan Sugalski <[EMAIL PROTECTED]> wrote:
Okay, at this point we've a pile of different array classes
Before we go any further we need to figure out what we want.
1) Unify setting/getting element count - the elements() vtable is unused (not accessible by opcode) - we use get_integer() - push for Array is unusabale currently - reserve array store size before filling can have performance benefits by avoiding reallocation
Okay. So, let's do the following:
*) Expose elements as an op. Two, actually, as we should have a get and set version.
*) Expand elements to get_elements and set_elements
2) Array vs PerlArray 3) SArray
If SArray is obsolete, let's kill it. I'd like to ultimately have a fixed-size PMC array, a variable size PMC array, fixed-size typed arrays, and variable-sized typed arrays. For the moment the fixed and variable sized PMC arrays are fine. Folks seem to want a mixed-type array as well, and while we'll pay performance for that I don't see any reason to not do it, though we can live with a fixed-size version for now.
So, lets do the classes as:
*) Array - fixed-size, mixed-type array *) vPArray - variable-sized PMC array *) PArray - Fixed-size PMC array *) vSArray - variable-sized string array *) SArray - fixed-size string array
And so on, for N and I arrays. I'm not particularly attached to the names. (Actually I think they suck, but they are reasonably descriptive)
Personally I'd leave Array as it is, since it does one of the things that we need it to do. PerlArray can be a full subclass of vPArray, since right now they're the same thing. That may change at some point later on.
4) list.c
- is too complicated for the current usage patterns
A currently better implementation could be e.g.
- one buffer array - a start index to accomodate shift/unshift - resize by 2 << n until a certain limit, then by that limit - after pop/shift shrink buffer by limit if limit+threshold is free
If you want to hack in on this, go ahead, though it looks like something that we'll ultimately need--its the guts of a sparse mixed-type array, which is useful and we may well need at some point.
--
Dan
--------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk