unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: martin rudalics <rudalics@gmx.at>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: [acm@muc.de: Re: Emacs 22.2 release plans - request for a slight delay.]
Date: Mon, 17 Mar 2008 09:04:49 +0000	[thread overview]
Message-ID: <20080317090449.GA2100@muc.de> (raw)
In-Reply-To: <47DE1EB9.6070707@gmx.at>

Guten Morgen, Martin!

On Mon, Mar 17, 2008 at 08:33:13AM +0100, martin rudalics wrote:
> > For me (1.2 Ghz Athlon) C-M-a from EOB in .../src/lisp.h take ~1.5
> > seconds.  Previously, it was about 30 seconds.  That's an order of
> > magnitude speed up.

> I appreciate that.  The problem is that `add-change-log-entry' here
> still spends some 7 secs not finding anything useful with `point' on
> the line reading

> extern Lisp_Object safe_alloca_unwind (Lisp_Object);

> admittedly also because `add-change-log-entry' is rather stupid.

It calls c-beginning-of-defun 5(?) times whilst locating the name of the
current defun.  It does this because it has to jockey about, feeling out
whether it started _inside_ the function block, somewhere in the
function's header, etc.

I think the answer to this is to write the following in cc-cmds.el:

    (defun c-defun-name (&optional pos)
      "Return the name of the current function, or the one at POS.

    \"Function\" here means any named structure with a brace block, and
    \"current\" means the one surrounding point, starting or terminating at
    point.

    If there is no current function, return nil."
    .....
    )

That should reduce the above `add-change-log-entry''s time to ~ 1 second.

> > The problem is that it is impossible to decide without an unbounded
> > search whether
> >
> >     int foo [50] ;
> >     (char *) bar ;
> >
> > occurring at the outermost nesting level of a file.c is declaring global
> > variables or is a k&r region declaring function parameters.

> > I'd welcome suggestions as to how to speed it up, though.  I can't see
> > much alternative to what I've done (put a limit on 20 paren/bracket
> > pairs in a k&r region) unless I put in a "column 0 heuristic", something
> > I'd realy rather not do.

> I'm puzzled that (parse-partial-sexp (point-min) (point-max)) completes
> instantaneously here (without any paren/brackets limits).

Isn't there some sort of cacheing of p-p-s?  Anyhow, let us rejoice, not
puzzle, over this.  :-)

-- 
Alan Mackenzie (Nuremberg, Germany).




  reply	other threads:[~2008-03-17  9:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-07  7:27 [acm@muc.de: Re: Emacs 22.2 release plans - request for a slight delay.] Alan Mackenzie
2008-03-16 14:11 ` martin rudalics
2008-03-16 19:36   ` Alan Mackenzie
2008-03-17  3:09     ` Stefan Monnier
2008-03-17  7:33     ` martin rudalics
2008-03-17  9:04       ` Alan Mackenzie [this message]
2008-03-17  9:30         ` martin rudalics
2008-03-25 23:17           ` Alan Mackenzie
2008-03-17 13:37         ` 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=20080317090449.GA2100@muc.de \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rudalics@gmx.at \
    /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).