Hatables are slow

2022-02-21 Thread Stefan Israelsson Tampe
A datastructure I fancy is hash tables. But I found out that hashtables in guile are really slow, How? First of all we make a hash table (define h (make-hash-table)) Then add values (for-each (lambda (i) (hash-set! h i i)) (iota 2000)) Then the following operation cost say 5s (hash-fold (lam

Re: Hatables are slow

2022-02-21 Thread Mikael Djurfeldt
The hash table in Guile is rather standard (at least according to what was standard in the old ages :). (I *have* some vague memory that I might have implemented a simpler/faster table at some point, but that is not in the code base now.) The structure is a vector of alists. It's of course importa

Re: Hatables are slow

2022-02-21 Thread Mikael Djurfeldt
(Note that the resizing means *rehashing* of all elements.) On Mon, Feb 21, 2022 at 11:17 PM Mikael Djurfeldt wrote: > The hash table in Guile is rather standard (at least according to what was > standard in the old ages :). (I *have* some vague memory that I might have > implemented a simpler/f

hastbables in scheme, are they slow? using goops is this madness

2022-02-21 Thread Stefan Israelsson Tampe
Hi, I did some research about guile's hashtables and have tried a few versions of it in guile scheme from using enormous macro expansions to goops object oriented layers. What I found is 1. For small hashtables, scheme based solutions are superior to C based 2-3X faster for a hastables of size 40

Re: 'guild compile' and C(++) extensions (in the context of LilyPond)

2022-02-21 Thread Jean Abou Samra
Le 19/02/2022 à 22:25, Olivier Dion a écrit : On Sat, 19 Feb 2022, Jean Abou Samra wrote: I had similar problem with Jami. I added C++ primitives to Guile, but these were not load using the foreign function interface. Note, I'm using Guile 3.0.8, but I think the same could be done for Guil

Re: hastbables in scheme, are they slow? using goops is this madness

2022-02-21 Thread Maxime Devos
Stefan Israelsson Tampe schreef op di 22-02-2022 om 00:05 [+0100]: > 2. For very large hash tables C based solutions are about 1.5-2.0 > faster. > (for-each (lambda (i) (hashq-set! h i i)) (iota 2000)) For what sizes is Scheme faster, and for what sizes is Scheme faster? Where is the cut-off