chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] hash-tables


From: Felix Winkelmann
Subject: Re: [Chicken-users] hash-tables
Date: Mon, 24 Nov 2003 11:12:15 +0100
User-agent: Opera7.21/Win32 M2 build 3218

Am Mon, 24 Nov 2003 11:04:31 +0100 hat address@hidden <address@hidden> geschrieben:

From      : "Felix Winkelmann" address@hidden
For short data-sets an association-list will likely be more efficient.
Since Chicken uses a copying garbage-collector, one cannot (unfortunately) just take the address of an object in the heap and use that as a hash-code
(which would be damn fast), so the hash-code has to be computed from
the contents of the data. Actually, I exclusively use a-lists, unless
I know it's going to be a big table. Doing some benchmarking for your
particular application might be worthwhile.

I guess there are time routines for benchmarking purpose, but in the manual I find time routines more related to the calendar. What should I use for benchmarks?

[syntax] (time EXP1 ...)
Evaluates EXP1 ... and print elapsed time and memory information. The result of the last expression is returned.


> 2) I see in the manual that "get" and "put!" can have a "property"
> argument; what's that?
>

The property may be anything, but it will be compared using `eq?'.

So ??  I do not get the purpose of properties from this reply.

You can put multiple properties under a specific hash-table key.
This is just a thin wrapper around hash-tables that contain
a-lists as values. This is somewhat similar to the "disembodied"
property lists of Common LISP.

(define t (make-hash-table))

(put! t 'michele 'country 'it)
(put! t 'michele 'name 'simionato)

(get t 'michele 'country)   ==>   it


cheers,
felix




reply via email to

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