[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: /srv/bzr/emacs/trunk r101338: * lisp/emacs-lisp/syntax.el (syntax-pp

From: Stefan Monnier
Subject: Re: /srv/bzr/emacs/trunk r101338: * lisp/emacs-lisp/syntax.el (syntax-ppss): More sanity check to catch
Date: Thu, 13 Feb 2014 08:28:40 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

>> In 99% of the cases, syntax-ppss is only called once during font-lock.
>> So, while in theory, yes, we might still get some benefits, in practice
>> we don't.
> `syntax-propertize' can call it multiple times, though (at least in the case
> of ruby-mode), and that's called as often as font-lock.

Yes, that's part of the remaining 1%.

> By the way, AFAICT, the juggling of local variables between modes (save,
> restore, rinse, repeat) is one of the major factors in mmm-mode performance.

I can believe that.

> There was an old `multi-mode' by Dave Love that used indirect buffers to
> keep the buffer-local values around, and switched between them in
> post-command-hook (which might or might not have been a good idea) and in
> `multi-fontify-region', taking advantage of the fact that fontification in
> an indirect buffer translates into the base buffer.
> Now I hear that we shouldn't use indirect buffers.

Indeed, I don't think using an indirect buffer is a good solution.
I'm not even sure it's faster than mmm's "manual" variable switch.

> Would there be a fast way to save and restore all local variables in
> a buffer? This would cut down on both mmm-mode overhead
> and complexity.

Not sure how best to speed it up.  We could of course reduce the
interpretation overhead by providing a kind of "context-switch"
primitive written in C.  This would probably speed it up significantly.

But making it do really less work is difficult: there's the
"local-variables" alist in the "struct buffer" which we could switch in
one step, but:
- it doesn't account for all local variables (doesn't account for those
  local-vars held directly in the "struct buffer" such as tab-width).
- it would switch some vars which should not be switched.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]