all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Lars Hamren <hamren@sdu.se>
Cc: 7069@debbugs.gnu.org
Subject: bug#7069: Compilation from within emacs becomes slower and slower until Emacs is restarted
Date: Wed, 20 Apr 2011 10:10:30 -0300	[thread overview]
Message-ID: <jwvk4eprsu3.fsf-monnier+INBOX@gnu.org> (raw)
In-Reply-To: <4DAEAFB9.8090900@sdu.se> (Lars Hamren's message of "Wed, 20 Apr 2011 12:04:41 +0200")

> 	(add-hook 'compilation-mode-hook
> 	  (lambda () (setq compilation-error-regexp-alist
> 	      (cons
> 	       ;; Quartus II error messages
> 	       '(".*Verilog .* at \\(.+\\)(\\([0-9]+\\)): .*" 1 2)
> 	      compilation-error-regexp-alist))))

There are various optimizations you can do on this regexp (such as
remove the trailing ".*"), but the only one I can see that should make
a significant difference in terms of performance is the leading ".*".
I.e. remove the ".*" at the beginning (compilation regexps are not
anchored at the BOL since Emacs-22, IIRC).  This should speed things up
significantly.  If you insist on keeping the ".*" because you like the
resulting highlighting, then add a "^" before it.
  
> I haven't looked further into why this should be a problem.

I can't think of any reason why this regexp should make compilation
become slower (I can see why it would make it slow, but unless lines
become longer over time, it should keep the same slowness at the end as
it had at the beginning).

Then again, this may depend on the version of Emacs you're using.
I've made some changes to the way compilation messages are parsed in the
upcoming Emacs-24 code (not specifically for performance reasons, but it
does impact performance), so if you could try out the development code
that would be helpful: I'd like to resolve such performance bugs before
Emacs-24 is released.

> The regexp is quite simple, and doesn't match when compiling with g++.

Depending on the shape of the regexp, the "doesn't match" case can be
the worst case, because the regexp-matcher has to try *all* the possible
ways in which it might match before reporting a match failure, whereas
a successful match would stop as soon as the first way to match
is found.


        Stefan





  reply	other threads:[~2011-04-20 13:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-19  0:38 bug#7069: Compilation from within emacs becomes slower and slower until Emacs is restarted Lars Hamren
2010-09-19 18:14 ` bug#7069: Problem only with "compile", not with "shell-command" Lars Hamren
2010-09-19 18:32 ` bug#7069: Clarification Lars Hamren
2010-09-22  6:43 ` bug#7069: Compilation from within emacs becomes slower and slower until Emacs is restarted Jan Djärv
2010-10-28  2:42 ` Stefan Monnier
2011-04-20 10:04 ` Lars Hamren
2011-04-20 13:10   ` Stefan Monnier [this message]
2011-04-25  1:16     ` Daniel Colascione
2011-04-25 12:28       ` Stefan Monnier
2011-04-25 13:05         ` Lars Hamren

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

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

  git send-email \
    --in-reply-to=jwvk4eprsu3.fsf-monnier+INBOX@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=7069@debbugs.gnu.org \
    --cc=hamren@sdu.se \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.