guile-user
[Top][All Lists]
Advanced

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

Re: cannot compile: srfi-10 define-reader-ctor 'hash '#,(


From: Marko Rauhamaa
Subject: Re: cannot compile: srfi-10 define-reader-ctor 'hash '#,(
Date: Thu, 14 Aug 2014 22:24:04 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Taylan Ulrich Bayirli/Kammer <address@hidden>:

> Marko Rauhamaa <address@hidden> writes:
>
>> Yes. In my recent tests, I found (assq-ref) was twice as fast as
>> (hashq-ref) when there were 100 entries even when I made the hash
>> table quite large (1000 entries IIRC).
>
> Do you mean the averages?

I was looking for the 50th entry.

> For me, accessing the *first* entry of an alist already seems to be
> almost as slow as accessing any entry of a hash table, and accessing
> the 100th about thrice as slow.

Ok. I ran the test again, with a couple of parameter settings this time
round:

   ===================================================
   Data Structure    # Entries   Look-up Duration (µs)
   ===================================================
   hash-table           2000           0.37
   alist                2000           5.88
   AVL tree             2000          15.65
   hash-table            100           0.35
   alist                 100           0.31
   AVL tree              100          11.09
   ===================================================

The entry that was looked up was the middle element. The lookup was
performed 1,000,000 times. The AVL tree was wholly implemented in
scheme.

So the alist wasn't "twice as fast". Must have been with fewer entries.


Marko



reply via email to

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