From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel 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 Message-ID: References: <87r47bi1e5.fsf@yandex.ru> <52F96284.50507@yandex.ru> <52FAE12B.6060101@yandex.ru> <52FC3BEE.60604@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1392298134 11426 80.91.229.3 (13 Feb 2014 13:28:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Feb 2014 13:28:54 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 13 14:29:01 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WDwLb-0001Vw-5o for ged-emacs-devel@m.gmane.org; Thu, 13 Feb 2014 14:28:59 +0100 Original-Received: from localhost ([::1]:46327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDwLa-0006Tg-N3 for ged-emacs-devel@m.gmane.org; Thu, 13 Feb 2014 08:28:58 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDwLQ-0006Sx-Sr for emacs-devel@gnu.org; Thu, 13 Feb 2014 08:28:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WDwLJ-000285-JC for emacs-devel@gnu.org; Thu, 13 Feb 2014 08:28:48 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:13476) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WDwLJ-00027s-CP for emacs-devel@gnu.org; Thu, 13 Feb 2014 08:28:41 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFLd+Gg/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDh8HBwsUGA0kLodwBsEtjVWDNQOIYZwZgV6DFQ X-IPAS-Result: Av8EABK/CFFLd+Gg/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDh8HBwsUGA0kLodwBsEtjVWDNQOIYZwZgV6DFQ X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="47523399" Original-Received: from 75-119-225-160.dsl.teksavvy.com (HELO pastel.home) ([75.119.225.160]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 13 Feb 2014 08:28:40 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 562B360079; Thu, 13 Feb 2014 08:28:40 -0500 (EST) In-Reply-To: <52FC3BEE.60604@yandex.ru> (Dmitry Gutov's message of "Thu, 13 Feb 2014 05:28:46 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:169581 Archived-At: >> 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. Stefan