unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Kevin Ryde <user42@zip.com.au>
To: guile-devel@gnu.org
Subject: Re: Evolution & optimization of the module system
Date: Thu, 22 Feb 2007 09:21:46 +1100	[thread overview]
Message-ID: <87wt2bxibp.fsf@zip.com.au> (raw)
In-Reply-To: <87irdyxzy3.fsf@laas.fr> (Ludovic Courtès's message of "Mon, 19 Feb 2007 10:24:20 +0100")

ludovic.courtes@laas.fr (Ludovic Courtès) writes:
>
> Actually, `process-duplicates' is O(N*USES) _for each module used_.  So
> the overall duplicate processing is really O(N*USES^2).  With the
> patched version, the whole process is O(N*USES).  That can make quite a
> difference when USES > 1.

It should be ok, it's only hash table lookups, which are fast.  And N
is normally pretty modest too.

> Right, it increases the size of individual module objects.  I haven't
> made any measurements but I'm not sure whether it should be a concern,
> given that the number of modules is not supposed to be too high (i.e.,
> at most a few hundreds).  Any idea of an estimate of the memory occupied
> by a (balanced) hash table given its number of elements?

Copying the table of 2000 core bindings into every module doesn't
sound good, not if it's only for once-off duplicates checking.  If you
want you can check the existing innermost loops are good.  In
process-duplicates var1 and var2 are almost always different (one of
them #f usually), so getting that down to C with some sort of
"hashq-intersection" or "hashq-for-each-intersection" would help a
lot.  I'd predict throwing a little C at bottlenecks like that will be
enough.

Another possibility would be to defer duplicates checking until the
end of a define-module or use-modules form (or even until the end of
the file), if mutual cross-checks can be done faster en-block, if you
know what I mean.  It could use a temporary combined hash if that
helped (perhaps sharing bucket cells to save gc work).  The particular
"module-define!" you struck should obviously be only about USES many
hash lookups (ie. about a dozen typically), most of the time, if
that's not already the case.

> Depends on what you mean here.  Modules distributed with core Guile are
> not special-cased (and shouldn't be, IMO).

They're special in that we know there's no clashes between them.
process-duplicates should ignore any ice-9 vs ice-9, if that doesn't
happen already.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2007-02-21 22:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-17 15:15 Evolution & optimization of the module system Ludovic Courtès
2007-02-18 23:32 ` Kevin Ryde
2007-02-19  9:24   ` Ludovic Courtès
2007-02-21 22:21     ` Kevin Ryde [this message]
2007-02-22  9:20       ` Ludovic Courtès
2007-02-22 22:23         ` Kevin Ryde
2007-02-23 13:15           ` Ludovic Courtès
2007-02-25 23:37             ` Kevin Ryde
2007-02-26 21:15               ` Ludovic Courtès
2007-02-26 22:46                 ` Kevin Ryde
2007-02-27  8:21                   ` Ludovic Courtès
2007-04-08 23:06               ` Ludovic Courtès
2007-04-08 23:25                 ` Ludovic Courtès
2007-04-08 23:24               ` Ludovic Courtès
2007-04-30  8:39                 ` Ludovic Courtès
2007-05-05 20:48                   ` Ludovic Courtès
2010-07-20 21:20                     ` Andy Wingo
2010-07-20 22:24                       ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wt2bxibp.fsf@zip.com.au \
    --to=user42@zip.com.au \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).