all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: bug-cc-mode@gnu.org, emacs-pretest-bug@gnu.org, "Marshall,
	Simon" <simon.marshall@misys.com>, Richard Stallman <rms@gnu.org>,
	emacs-devel@gnu.org
Subject: Re: [simon.marshall@misys.com: Font Lock on-the-fly misfontification in C++]
Date: Mon, 24 Jul 2006 18:30:50 -0400	[thread overview]
Message-ID: <jwv7j22odyt.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20060724222954.GD1111@muc.de> (Alan Mackenzie's message of "Mon, 24 Jul 2006 23:29:54 +0100")

>> You haven't shown any evidence of inefficiency.

> I think I have, in our previous discussion.  I think it's clear that
> f-l-multiline properties are erased throughout the change-region, and
> have to be recalculated througout the change region, at every change.
> For most C-like languages, this will be expensive for large regions.  Of
> all the CC languages, you can only determine f-l region boundaries
> cheaply in AWK (and maybe IDL).  By contrast, f-l-extend-region only
> needs to do the calculation at the two ends of the changed region, and
> has to do it just as often.

I think you're comparing apples and oranges.

And even if it weren't, it's still no evidence of inefficiency (by
"evidence" I mean actual user-visible slowdown).  In all the examples I've
shown, there is no calculation to be done for f-l-multiline: just add the
property at the time when you know where to put it (i.e. you've already
done the calculation for the purpose of highlighting anyway).

> This extra calculution will delay the display of fresh buffer areas when
> scrolling, for example.

I must be missing your reference again.

>> > Is there any chance of you adapting the font-lock-multiline mechanism
>> > so that the properties can be applied _before_ fontification, exactly
>> > where they are needed, rather than _after_ fontification throughout
>> > the entire change region?

>> That's the thing on the backburner.  But it's still unrelated to the
>> OP's problem which was specifically about *re*fontification, where the
>> current font-lock-multiline support is all you need (and if you don't
>> like it, there are already several existing alternatives, see the
>> lispref manual).

> Could you be more explicit here, please, on what these alternatives are?

- jit-lock-defer-multiline
- your new font-lock after-change-function hook (currently called
  font-lock-extend-region-function)

> I've not been aware of them up to now.

Sorry to disappoint you, you knew them.

>> >     public Bar    // Bar fontified as a type, at first 
>> >                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>> Oh, I see.  It seems very minor.  Why do you care?  Is the performance
>> difference ever noticeable?  If yes, how often?

> I don't think we should be so casual about other people's processor
> cycles.  The performance difference will be very noticeable if Emacs ever
> comes to be run on application servers rather than individual desktops,
> for example.  If "public Bar" were a 20-line declaration, the delay might
> well be noticeable, especially on the sort of older PC's which still
> permeate the developed world.  ;-)

But the delay will be noticable anyway when editing the 20 line declaration
itself (which sems just as likely as editing a comment that follows it):
solving it for the comment is not enough, you need to be able to rehighlight
just the line that was touched, even if it was part of a long
multiline element.  At this point, unless you have very long lines, having
to round up to a whole number of lines is not much of a problem either.

Anyway, I'm not opposed to your proposed change to allow
non-wholeline fontification.  I doubt it'll be useful, but I can't see it
hurting either.

> Indeed, not.  But doing our stuff in a way that obfuscated C works right
> at no extra cost is not a bad way to go.

Agreed, but it's very different from what font-lock was designed to do.


        Stefan

  reply	other threads:[~2006-07-24 22:30 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1G3OAq-0004WV-P1@fencepost.gnu.org>
2006-07-23 14:26 ` [simon.marshall@misys.com: Font Lock on-the-fly misfontification in C++] Alan Mackenzie
2006-07-24  3:11   ` Stefan Monnier
2006-07-24 13:33     ` Alan Mackenzie
2006-07-24 14:36       ` Stefan Monnier
2006-07-24 19:29         ` Alan Mackenzie
2006-07-24 20:43           ` Stefan Monnier
2006-07-24 22:29             ` Alan Mackenzie
2006-07-24 22:30               ` Stefan Monnier [this message]
2006-07-24 14:35   ` Stefan Monnier
2006-07-31 22:04     ` Alan Mackenzie
2006-07-31 22:03       ` Stefan Monnier
2006-08-01  9:21         ` Alan Mackenzie
2006-08-01 14:55           ` Stefan Monnier
2006-08-01 19:48             ` Alan Mackenzie
2006-08-01 19:23               ` Stefan Monnier
2006-08-03  8:45                 ` Alan Mackenzie
2006-08-03 15:12                   ` Stefan Monnier
2006-07-31 23:59       ` Richard Stallman
2006-08-01  7:59         ` Alan Mackenzie
2006-08-01  8:32           ` David Kastrup
2006-08-01 20:09           ` Richard Stallman
2006-08-01  8:06         ` Romain Francoise
2006-08-01 20:09           ` Richard Stallman
2006-08-02  9:38         ` Aidan Kehoe
2006-08-02  9:57           ` David Kastrup
2006-08-02 10:28             ` Aidan Kehoe
2006-08-02 11:57               ` David Kastrup
2006-08-02 12:52                 ` Aidan Kehoe
2006-08-02 13:21                   ` David Kastrup
2006-08-02 13:31                     ` Aidan Kehoe
2006-08-02 14:02                       ` David Kastrup
2006-08-02 13:59                 ` Stefan Monnier
2006-08-02 14:12                   ` Aidan Kehoe
2006-08-02 14:14                   ` David Kastrup
2006-08-02 21:20             ` Richard Stallman
2006-08-03  9:17               ` Alan Mackenzie
2006-08-03  8:42                 ` David Kastrup
2006-08-03  8:54                   ` Aidan Kehoe
2006-08-03 19:15                 ` Richard Stallman

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=jwv7j22odyt.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=emacs-pretest-bug@gnu.org \
    --cc=rms@gnu.org \
    --cc=simon.marshall@misys.com \
    /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.