my solution :)  its faster (at least on chicken 3.3.something).
timing on this box put this at just under 8s.

-elf

---

(use extras)

(print "filling ...")

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

(print "reading ...")

(define hits
    (let loop ((i   0)
               (r   0))
        (if (fx= i 10000)
            r
            (if (fx= (random 500000)
                     (hash-table-ref/default a (random 500000) -1))
                (loop (fx+ 1 i) (fx+ 1 r))
                (loop (fx+ 1 i) r)))))

(print "done.")





_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to