guile-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Efficient Gensym Hack


From: Ludovic Courtès
Subject: Re: [PATCH] Efficient Gensym Hack
Date: Sat, 10 Mar 2012 23:55:59 +0100
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.93 (gnu/linux)

Hi Mark,

Just a few questions.

Mark H Weaver <address@hidden> skribis:

> Here's an implementation of the efficient gensym hack for stable-2.0.
> It makes 'gensym' about 4.7 times faster on my Yeeloong.  Gensyms are
> not given names or even numbers until they are asked for their names or
> hash values (for 'equal?' hash tables only).

Ooooh, I only really understood when seeing this:

+  return scm_double_cell (scm_tc7_symbol | SCM_I_F_SYMBOL_LAZY_GENSYM,
+                          SCM_UNPACK (prefix_stringbuf), (scm_t_bits) 0,
+                          SCM_UNPACK (scm_cons (SCM_BOOL_F, SCM_EOL)));

So you can actually ‘eq?’ or ‘hashq’ them regardless of whether they
have a name, nice!  :-)

> The first patch adds an optimization for strings that is important for
> gensyms.  It avoids locking a mutex when setting the shared flag on a
> stringbuf if the shared flag is already set.

How much impact does this have?  Thanks to futexes, mutex_lock should be
fairly cheap when there’s no contention, no?

Nice work!

Thanks,
Ludo’.




reply via email to

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