[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mysterious fontification/C++ context issue - Patch for beginning-of-
From: |
martin rudalics |
Subject: |
Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw. |
Date: |
Sat, 16 Dec 2006 11:17:55 +0100 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
>>M-> ran almost instantaneously before `beginning-of-defun-raw' changed.
>>And you did fill CC Mode's cache already before the change. I could
>>imagine it's because font-locking runs `beginning-of-defun' repeatedly
>>for decreasing buffer positions and the `syntax-ppss' cache doesn't
>>handle these cases optimally.
>
>
> I thought "no, can't be, 'cause I was careful to treat this correctly", so
> I went and measured it to give a clear proof of it, and much to my surprise
> you seemed to be right:
>
> parse-partial-sexp on the whole buffer takes about 0.08 seconds on my laptop
> (1.2GHz P-III M, maybe running at 800MHz at that time). syntax-ppss on that
> same buffer takes about 0.24s (about 3 times slower: not great, but seemed
> possible), but
>
> (syntax-ppss (point-max))
> (syntax-ppss (- (point-max) 2000))
> (syntax-ppss (- (point-max) 4000))
>
> takes a good 1.8s which doesn't make any sense.
I got approximately that far when I wrote the lines above.
> After the shock (thinking,
> god, I was wrong, how could that be?), I realized that these numbers didn't
> make any sense.
I simply felt puzzled and didn't dig any further.
> And sure enough the problem was that in xdisp.c
> syntax-begin-function is not nil but set to c-beginning-of-syntax which
> doesn't make any sense: if you don't want to use a heuristic, then set the
> damn thing to nil.
>
> This variable is set to c-beginning-of-defun in cc-mode.el via
> font-lock-beginning-of-syntax-function which is set via font-lock-defaults.
Does that mean we got the `_c_-beginning-of-defun' behavior through the
back-door? All that code existed before the open-paren-... change.
> - c-beginning-of-syntax
> + nil
Jumping to the end of xdisp.c still takes four seconds. I continue to
feel puzzled. Note that Alan binds `syntax-begin-function' to nil in
his `beginning-of-defun-raw' hence why should this have any impact in
the first place? I must take another look in the basements of that.
- Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., (continued)
- Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., martin rudalics, 2006/12/17
- Re: Mysterious fontification/C++ context issue - Patch for c-basic-common-init, Alan Mackenzie, 2006/12/17
- Re: Mysterious fontification/C++ context issue - Patch for c-basic-common-init, Chong Yidong, 2006/12/17
- Re: Mysterious fontification/C++ context issue - Patch for c-basic-common-init, Alan Mackenzie, 2006/12/17
- Re: Mysterious fontification/C++ context issue - Patch for c-basic-common-init, Chong Yidong, 2006/12/17
- Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., Stefan Monnier, 2006/12/17
- Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., Stefan Monnier, 2006/12/15
- Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw.,
martin rudalics <=
- Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., Chong Yidong, 2006/12/16
- Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., martin rudalics, 2006/12/16
- Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., martin rudalics, 2006/12/16
- Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., Chong Yidong, 2006/12/16
- Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., martin rudalics, 2006/12/16
- Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., Chong Yidong, 2006/12/16
- Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., Chong Yidong, 2006/12/16
- Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., martin rudalics, 2006/12/16
- Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., Stefan Monnier, 2006/12/16
- Re: Mysterious fontification/C++ context issue - Patch for beginning-of-defun-raw., martin rudalics, 2006/12/16