First get it right, then get it fast.

... getting it fast may mean changing the underlying data structures.

On Sunday, Feb 23, 2003, at 16:29 America/New_York, Gabe Garza wrote:

>
> On Sun, Feb 23, 2003 at 03:33:53PM -0500, rif wrote:
>> I just did my own little experiment (I can't post the source, as my
> ....

> Here's my own stab at it (put the following forms in a file, compile
> it, then load...):
>
> (defstruct foo
>   (a 0d0 :type double-float)
>   (b 0 :type fixnum))

The above is fine, but I can also have the following equivalent 
representation

(defstruct (foos (:constructor %foo))
     (doubles nil :type (array double-float *)) ; Do I miss the (or null 
...)?
     (ints nil :type (array fixnum *)))

And then I can inline the accessors (and the "public" constructor 
make-foo).

(declaim (inline foos-int-at foos-double-at)))

(defun foos-int-at (foos index)
    (declare (type foos foos) (type #.(list 'integer 0 
,array-dimension-limit) index)) ; CMUCL already has the `index' type.
    (aref (foos-ints foo) index))

etc etc

I don't know if it helps, but it may....

Incidentally, the above is a case for building abstraction in the first 
place in any case.

Cheers



--
Marco Antoniotti
NYU Courant Bioinformatics Group                tel. +1 - 212 - 998 3488
715 Broadway 10th FL                            fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.


Reply via email to