From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id MMbRD7wufl9kYAAA0tVLHw (envelope-from ) for ; Wed, 07 Oct 2020 21:10:20 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id UCqTC7wufl/7BgAAB5/wlQ (envelope-from ) for ; Wed, 07 Oct 2020 21:10:20 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 90D33940223 for ; Wed, 7 Oct 2020 21:10:19 +0000 (UTC) Received: from localhost ([::1]:56194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQGhV-0007e5-3N for larch@yhetil.org; Wed, 07 Oct 2020 17:10:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQGh4-0007dr-1q for emacs-orgmode@gnu.org; Wed, 07 Oct 2020 17:09:50 -0400 Received: from mout-p-202.mailbox.org ([80.241.56.172]:16160) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1kQGh1-0005jm-BW for emacs-orgmode@gnu.org; Wed, 07 Oct 2020 17:09:49 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4C66RB3rsnzQkjG for ; Wed, 7 Oct 2020 23:09:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1602104980; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=004UVivnxNJGLoXQRxaEMR6Ld48Oo6GFiRfoycPruAs=; b=KUNh/Wfi1CSKrcYqQXE9b5S/Q9RlSI4e0jkcK4QAiI1135kJZdqE7501LEcNSUMRQcMVK+ g+k2UDfrGWbjYPoIH4nkMQ5Ob6W9NAqhP1g9BFr9PY6YG2YhXayqHWcyq7geemp8oDpqGn xlLLVoHpB9FsQLgDLoEYfrJ1a3ll8bxSofFfXgj1n9D2sBQYLq2ITsZYEiHeqF7vglTBXn 19uS1azYa1GgEZrEklBOBVti04AQ6qVOUQx0daAcfGVV5NUpp442gGqVoWy802kzmeMdqj +H4RT3ziA9yqz1nTtiExqQmqlpB6RBMzE1lidIsdxtU8OxPoz5IIa2RFl2i+YQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mailbox.org; h= content-transfer-encoding:content-type:content-type:mime-version :date:date:message-id:from:from:in-reply-to:subject:subject :references:received; s=mail20150812; t=1602104979; bh=lyKI254F/ 1wIYSGmJ96Cu5vojHclWZDPCkL9G4yf/Rg=; b=HNJIDvDz10pTiVrqK4NqwDMCF 8PlNVG9ny/bK6aZweXB9Kf/X/TIbgSxKYXYGMGUMZ/h7uo5Je5PxdDSY+q9w+geJ a3buAhKssYu/3LQR1t5lIPPgmEOJt0xuJemyMiBDu3R10EIdWQPHj2FcAUSINcid R7kVOMxXVa2mNCOng5Ag7es196YiWL6hM9AFCilExZkK+76KFZ+M0hJDDrnTZw2V 69qtZreaiF9BZ115LwhKF7OfOAiwbf4JUBj4+XcaC7LFQkNtxBOzYRr0slVbeVDe gcFzPk/qdJZsiGrK+4n/fbCF/ajIL9OqsMnLSCoWtetTvcduilbqIn4ye2Qzw== X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id FiAz7V7AsUMP; Wed, 7 Oct 2020 23:09:39 +0200 (CEST) To: tfr@mailbox.org References: Subject: Bug: performance issue in org-font-lock-add-priority-faces related to org-priority-regexp [9.4 (9.4-7-g3eccc5-elpaplus @ /home/standard/.emacs.d/elpa/26.3/develop/org-plus-contrib-20200921/)] In-Reply-To: <87bbd664-2da6-0551-25f1-9ff287fed9f2%40mailbox.org> Cc: emacs-orgmode@gnu.org From: Tim Frana Message-ID: Date: Wed, 7 Oct 2020 23:09:40 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-MBO-SPAM-Probability: X-Rspamd-Score: -3.31 / 15.00 / 15.00 X-Rspamd-Queue-Id: 8E04C13E2 X-Rspamd-UID: 5ab4b1 Received-SPF: pass client-ip=80.241.56.172; envelope-from=tfr@mailbox.org; helo=mout-p-202.mailbox.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/07 17:09:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=mailbox.org header.s=mail20150812 header.b=KUNh/Wfi; dkim=pass header.d=mailbox.org header.s=mail20150812 header.b=HNJIDvDz; dmarc=pass (policy=quarantine) header.from=mailbox.org; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.71 X-TUID: /FSqDYjSzRAb Apologies, the extreme slowdown for the regex in my setup is mostly credited to a very long line in my org file (~100k characters). I inserted a snippet from a log file to a quote block, without realizing that a large base64 string was hiding at the end of one line. The old regex could exclude that line early on, because it wasn't a header line, so I didn't notice a performance hit back then. With that line deleted (org file shrinks to ~300KB), I measured performance with the new and old regex (new on 1st line vs old on 2nd line): (elp-instrument-function 'org-font-lock-add-priority-faces) (elp-reset-all) ;; open org file (elp-results)      Function Name                     Call Count  Elapsed Time Average Time new: org-font-lock-add-priority-faces  28          0.0228787000 0.0008170964 old: org-font-lock-add-priority-faces  28          0.0007937999 2.834...e-05 So the new one is still considerably slower, but probably not noticeable unless the file is really large and/or it contains long lines. One last remark, my workaround from the last mail is flawed, e.g. it broke priority sorting in my agendas. This one worked better: (defun adv--org-font-lock-add-priority-faces (wrapped-func &rest args)   (let ((org-priority-regexp "^\\*+ .*?\\(\\[#\\([A-Z0-9]+\\)\\] ?\\)"))     (apply wrapped-func args))) (advice-add 'org-font-lock-add-priority-faces :around #'adv--org-font-lock-add-priority-faces)