[Top][All Lists]
[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
- [Chicken-users] Good way to code the equivalent to this?, Matt Welland, 2008/08/23
- Re: [Chicken-users] Good way to code the equivalent to this?, Elf, 2008/08/24
- Re: [Chicken-users] Good way to code the equivalent to this?, Elf, 2008/08/24
- Re: [Chicken-users] Good way to code the equivalent to this?, Jim Ursetto, 2008/08/24
- Re: [Chicken-users] Good way to code the equivalent to this?, Matt Welland, 2008/08/24
- Re: [Chicken-users] Good way to code the equivalent to this?, Tobia Conforto, 2008/08/25