Hi!

This should perform much better and more closely
resembles what you are trying to achieve.

Note that Perl's data structures are bummed to absurd
dimensions. We don't want that.


cheers,
felix
--

(use extras)

(define a (make-hash-table equal?))

(print "filling ...")

(do ((i 0 (add1 i)))
    ((>= i 250000))
  (hash-table-set!
   a
   (cons (random 500000) (random 500000))
   #t))

(print "reading ...")

(do ((i 0 (add1 i))
     (hits 0))
    ((>= i 10000))
  (let ((x (random 500000))
        (y (random 500000)))
    (when (hash-table-ref/default a (cons x y) #f)
      (set! hits (add1 hits)))))

(print "done.")


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

Reply via email to