From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: footnote fontify causing massive slowdown Date: Sat, 05 Dec 2015 16:35:24 +0100 Message-ID: <87610crjr7.fsf@nicolasgoaziou.fr> References: <87egf1qcgn.fsf@nicolasgoaziou.fr> <87h9jx2eiy.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a5Eq8-0002qh-FG for emacs-orgmode@gnu.org; Sat, 05 Dec 2015 10:33:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a5Eq7-0002N5-H6 for emacs-orgmode@gnu.org; Sat, 05 Dec 2015 10:33:36 -0500 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:42153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a5Eq7-0002Mi-B8 for emacs-orgmode@gnu.org; Sat, 05 Dec 2015 10:33:35 -0500 In-Reply-To: <87h9jx2eiy.fsf@gmail.com> (Aaron Ecay's message of "Sat, 05 Dec 2015 13:47:33 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Derek Feichtinger Cc: emacs-orgmode@gnu.org Hello, Aaron Ecay writes: > Indeed. However, this code was needlessly slow because it failed to > take advantage of short-circuit evaluation. According to the profile report, I don't understand the logic of your patch. >>> - org-footnote-in-valid-context-p 4106 44% >>> + org-inside-LaTeX-fragment-p 2380 25% >>> + org-in-block-p 1563 16% >>> + org-in-verbatim-emphasis 159 1% ISTM that `org-in-block-p' is marginally slower (15%) than `org-inside-LaTeX-fragment-p' (9%). Of course, in OP's report, `org-in-block-p' is the test returning early, so pushing it earlier is faster since you don't call `org-inside-LaTeX-fragment-p', but this is only a very specific optimization made at the expense of other cases (and contradicts your commit message). Am I missing something? I don't understand either the benefit of adding `not' calls all over the place. I generally use de Morgan's law the other way and save a few primcalls. > Do [1]-type footnotes present other performance problems today? The main problem of plain footnotes isn't really their performance, but false positives'. Anytime something looks like a footnote in a buffer, you get a performance hit. This happens much more often with plain footnotes than with other footnote types. Moreover, false positives can introduce not-so-subtle problems during export (see for example 2c66e40c). Note that suggesting to not use them (the default value, actually, per `org-footnote-auto-label') doesn't help, since false positives are the problem, not real footnotes. Eventually, removing them doesn't remove any feature to Org. Of course, this is an incompatible change, and some users will need to update documents using plain footnotes. We can provide a function for that, and use `org-lint' to check for obsolete footnotes. The benefit is to avoid a whole class of problems. Regards, -- Nicolas Goaziou