all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Dan Nicolaescu <dann@ics.uci.edu>
Cc: emacs-devel@gnu.org
Subject: Re: slow output in *compilation* buffer
Date: Wed, 26 Aug 2009 14:56:44 -0400	[thread overview]
Message-ID: <jwvvdka76pl.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <200908260733.n7Q7X8Qh018681@godzilla.ics.uci.edu> (Dan Nicolaescu's message of "Wed, 26 Aug 2009 00:33:08 -0700 (PDT)")

>> Ah, I see.  So yes, the likely solution is to make compile.el lazier:
>> use font-lock-syntactic-keywords and jit-lock (so the text past the end
>> of the window doesn't need to be scanned right away), and postpone more
>> of the work to next-error.

> elp says that most time is spent in `compilation-error-properties', if
> that helps...

Yes.  We should remove the call to previous-single-property-change from
that function and move it to next-error instead.

After all, the property we look for is almost never used, so
this previous-single-property-change takes time O(N) where N is the
amount of output that has already been received.  So overall, it causes
an O(N^2) behavior since it is called O(N) times.

>> > BTW, doing the same search with M-x rgrep is MUCH MUCH slower.
>> That sucks.  What does rgrep do so differently to make it even worse?
> My guess would be more highlighting: it also highlights the matched
> words on each line.

That's possible, but I'd expect there's something more at play here.

> That means 50974295/4509 = 11305 lookup_char_property calls per Fprevious_single_property_change ... 
> that sounds a bit excessive.

Since lookup_char_property will be called for each interval (i.e. chunk
of text with the same text-properties) between point and the previous
position where the property of interest is changed (which will usually
be (point-min) in our case), I think it's about right (let's see: 4500
lines, each line has at least 3-4 chunks with different properties, for
a total of about 20000 chunks, so about 10000 scanned per call on
average).


        Stefan




  reply	other threads:[~2009-08-26 18:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-22  8:23 slow output in *compilation* buffer Dan Nicolaescu
2009-08-23  1:28 ` Stefan Monnier
2009-08-23  6:27   ` Dan Nicolaescu
2009-08-25 17:21     ` Stefan Monnier
2009-08-25 21:37       ` David Kastrup
2009-08-26  7:33       ` Dan Nicolaescu
2009-08-26 18:56         ` Stefan Monnier [this message]
2009-08-24 18:52   ` Dan Nicolaescu
2009-08-24 19:13     ` Chong Yidong
2009-08-24 19:36       ` Dan Nicolaescu
2009-08-24 20:24     ` Dan Nicolaescu

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=jwvvdka76pl.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=dann@ics.uci.edu \
    --cc=emacs-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.
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.