chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Good way to code the equivalent to this?


From: Elf
Subject: Re: [Chicken-users] Good way to code the equivalent to this?
Date: Sun, 24 Aug 2008 03:56:10 -0700 (PDT)


for an improvement in time (surprisingly), use

(define a
    (alist->hash-table
        (let loop ((i   0)
                   (r   '()))
            (if (fx= 250000 i)
                r
                (loop (fx+ 1 i)
                      (cons (cons (random 500000) (random 500000)) r))))
        =))

instead. personally, id test both on whatever box youre running, as there are a lot more minor GCs this way. the alist->hash has an interesting property,
though... the first value (if there are duplicate keys) seems to be the one
thats used, the others are ignored.  however, its a lot faster to build the
list than to do the hash-table-set!, interestingly.

-elf





reply via email to

[Prev in Thread] Current Thread [Next in Thread]