unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Converting CC Mode's obarrays to hash tables.  [Was: new `obarray` type]
Date: Sun, 23 Jul 2017 14:03:10 +0000	[thread overview]
Message-ID: <20170723140310.GA2551@acm> (raw)
In-Reply-To: <jwvo9x2zct1.fsf-monnier+emacs@gnu.org>

Hello, Stefan.

On Wed, Mar 15, 2017 at 13:25:08 -0400, Stefan Monnier wrote:
> > There are currently four uses of (make-vector LENGTH 0) in CC Mode, at
> > least one of which, possibly two, genuinely deal with Lisp symbols.
> > Converting those to hash-tables would probably be a net loss, though
> > converting the ones which just use obarrays as a string look-up would
> > surely gain.

> I just tried such a conversion on all 4 uses.

> The result isn't that bad, but indeed contrary to the EIEIO case, I get
> a slight slow down (somewhat lost in the measurement noise, but still
> a disappointment for me).  The culprit seems to be the use of cl-structs
> instead of symbols in c-lang-constants (I can recover some of the speed
> by adding (:type vector) (:named nil) to the defstruct definition).

I've just converted c-found-types to use a hash table.  The result was a
slight, but measurable and worthwhile, speed increase, of between 1% and
2%.

As for c-keywords-obarray (an obarray which has C (etc.) keywords as its
symbols, whose property lists contain the various keyword categories the
keywords belong to) - what is the benefit of holding collections of
symbols in hash tables rather than obarrays?  If this makes a program
faster, it suggests that the obarray implementation could be improved to
match the speed of the hash table implementation.  Why don't we store
the main Emacs obarray in a hash table, if this will increase speed?

> In case you're interested in extracting the rest, find the patch below
> (which was pretty thoroughly *un*tested),

Thanks, I read it.

>         Stefan

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).



  parent reply	other threads:[~2017-07-23 14:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13  1:36 new `obarray` type Stefan Monnier
2017-03-13 15:49 ` Eli Zaretskii
2017-03-13 17:22   ` Stefan Monnier
2017-03-13 22:03 ` Alan Mackenzie
2017-03-14  1:46   ` Herring, Davis
2017-03-14 12:52   ` Stefan Monnier
2017-03-14 20:14     ` Alan Mackenzie
2017-03-15 17:25       ` Stefan Monnier
2017-03-15 18:19         ` Lars Brinkhoff
2017-03-15 19:24           ` (:named nil) in cl-defstruct (was: new `obarray` type) Stefan Monnier
2017-03-15 19:39             ` Noam Postavsky
2017-03-15 20:28               ` (:named nil) in cl-defstruct Stefan Monnier
2017-07-23 14:03         ` Alan Mackenzie [this message]
2017-07-24 14:06           ` Converting CC Mode's obarrays to hash tables. [Was: new `obarray` type] Stefan Monnier

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/emacs/

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

  git send-email \
    --in-reply-to=20170723140310.GA2551@acm \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).