On Wed, Sep 9, 2009 at 1:14 PM, Andrew Whitworth <wknight8...@gmail.com> wrote:
> On Wed, Sep 9, 2009 at 9:36 AM, Austin
> Hastings<austin_hasti...@yahoo.com> wrote:
>> Adding ppsu would make PVM "more complete", but it probably wouldn't change
>> the way people are writing PIR - old habits, etc.
>
> The Fixed*Array types allocate a fixed amount of storage. Adding ppsu
> ops to it would require keeping track of not only how much storage we
> have allocated (some of which is possibly empty), but also keeping
> track of where the current "beginning" and "end" of the array are, so
> we can add/remove items from both ends. Also, if we start talking
> about the edge cases where we try to push on more objects then there
> is space, we either need to throw exceptions or start rotating
> objects, or whatever. What we'd end up with is some variant on a
> circular buffer, which is much more heavy weight then we really need.
>
> However we do it, we're adding a lot of runtime checks and additional
> logic to support the kinds of dynamic operations that Resizable*Array
> PMCs already implement. We don't need both sets of PMCs to implement
> all the same behaviors. If you need ppsu ops, use the Resizable*
> variants and the associated performance penalties. If you don't need
> the capability, use the Fixed* ones which are less expensive by
> design.
>
> --Andrew Whitworth
> _______________________________________________
> http://lists.parrot.org/mailman/listinfo/parrot-dev
>

Again, this doesn't work if someone is passing you a PMC; you'll have
to introspect the type (dangerous, subclasses) or the 'does' (useless,
both types claim to do array). Is there another way to distinguish
these two types of aggregates?

I would be interested to see the performance timings for things as
they stand. I would be (pleasantly) surprised if indexed access is
faster for fixed.

If the performance only is slow when using push and friends, but still
fast when doing indexed access I don't see the problem here.

This also brings up a related note, that 'elements' behaves
differently across these 2 array types (one returning storage size,
one returning max(highest used element,storage size)). This is another
case where these types should either work similarly (so that when you
pass an array around you can use it without having to check which kind
of aggregate you have), or have a clear way to distinguish between the
two.

-- 
Will "Coke" Coleda
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev

Reply via email to