[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Access time of elements Re: Bad things []

Per Bothner <per@xxxxxxxxxxx> writes:
> Jussi Piitulainen wrote:
> >Shall we switch, and is a vector good enough for an index object? (I
> >believe somebody asked for such packaging even apart from efficiency.)
> >
> A modest but not order-or-magnitude difference on a non-optimizing
> implementation is not does not IMO justify a less natural api.
>     --Per Bothner

I would contend that is it a *more* natural API. I find it just as
annoying as the compiler finds it inefficient to scan past an unknown
number of arguments to find something that should *always* be there.

Secondly, the index-type of the data structure should be atomic. It is
an atomic element (a number) in the single-dimensional case. Having a
different index type for a multi-dimensional array is entirely
reasonable - the type signatures of indexed aggregate data structures 
all remain the same. Which is more similiar to (vector-set! v index val):

        1 - (array-set! a index val)
     or 2 - (array-set! a index0 index1 index2 val)

The answer seems pretty obvious to me. Others with different esthetic
standards may disagree, but given that one *is* faster, and arguably
(not definitively) cleaner, why not go with it?

david rush
To get anywhere with programming we must be free to discuss and
improve subjective phenomena. and leave the objective metrics to
resultants such as bug reports.
	-- The Programmer's Stone (Alan Carter & Colston Sanger)