From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#58687: 29.0.50; Enabling pp-use-max-width dramatically slows down formatting of large sexps like org-persist--index Date: Thu, 12 Jan 2023 16:19:37 +0000 Message-ID: <87cz7j9146.fsf@localhost> References: <871qr1cn73.fsf@posteo.de> <87v8lc802g.fsf@localhost> <83edrzc1t2.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17976"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58687@debbugs.gnu.org, m.eliachevitch@posteo.de To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 12 17:20:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pG0JQ-0004Rp-12 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 12 Jan 2023 17:20:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pG0JE-0004JH-P8; Thu, 12 Jan 2023 11:20:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pG0J8-0004Iv-Ua for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2023 11:20:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pG0J8-0005KT-1i for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2023 11:20:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pG0J7-0000XA-TA for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2023 11:20:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Jan 2023 16:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58687 X-GNU-PR-Package: emacs Original-Received: via spool by 58687-submit@debbugs.gnu.org id=B58687.16735403541985 (code B ref 58687); Thu, 12 Jan 2023 16:20:01 +0000 Original-Received: (at 58687) by debbugs.gnu.org; 12 Jan 2023 16:19:14 +0000 Original-Received: from localhost ([127.0.0.1]:48426 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pG0IL-0000Vw-QR for submit@debbugs.gnu.org; Thu, 12 Jan 2023 11:19:14 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:35261) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pG0IJ-0000Vf-MQ for 58687@debbugs.gnu.org; Thu, 12 Jan 2023 11:19:12 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id B90B624026E for <58687@debbugs.gnu.org>; Thu, 12 Jan 2023 17:19:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1673540345; bh=DjB5gZvNTUDf751NAFISM8p/Z2BWDP0f8XNSy9HRPQU=; h=From:To:Cc:Subject:Date:From; b=FYUP5cGVFz3VgN5ikO3ffLTEH1+OqYvZ7junS9P5MV6Kh3WbxyM5kF5lAnGCn3qRE VoREjvtstfei7uoXesnkwTQqXVRU83RaZJ9VB35x7QqxXs3kxpyCKQgAEEtdWn/Q7p +OvQLsjGMsR3K+etM6/24HKdCpUIqmpSRda0ioMBpd1ali5Putu1JaSzyxpWqkIUpm 8aqcUb8xKIVDiRHyp6mERKbgoT1nEwmXCFu+hRQ3S28gQ6Jxf0+zuoBcW+NHYgThwa 9MdvjV9kg4885GCe4thUHr+IW6TKIhPA9G7t+bmZzU7eSp64X4y1DqKMoWem3a/KQn BxGaBWVCtdiXA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Nt8r86lpLz6trt; Thu, 12 Jan 2023 17:19:04 +0100 (CET) In-Reply-To: <83edrzc1t2.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:253232 Archived-At: Eli Zaretskii writes: >> > I attached a file with the value of my `org-persist--index` expression and a file with a benchmark where I run pp on it, which took me 25s when running it with emacs -Q. Until recently my org persist index was much longer, but I pruned it a bit back when I wasn't aware what exactly caused the slowdown. >> >> I'd like to bump this bug. > > Why? Because, I'd like to know if there are chances that it could be fixed. The original report demonstrates how this issue slows down Emacs quit time dramatically. I should either let-bind `pp-use-max-with' to nil in org-persist.el to work around the problem or wait for the fix. >> Observed: (19.617422592 2 1.0353073050000035) >> Expected: `pp' not taking ~20sec to write 15k of elisp data. > > Did you look at what pp.el does when pp-use-max-width is non-nil? I > show a profile below, to make that clear. > > The "regular" pp (when pp-use-max-width is nil) finishes almost > instantaneously in this case. > ... > 40041 85% - pp > 40041 85% - pp-to-string > 40041 85% - pp-emacs-lisp-code > 40028 85% - pp--insert-lisp > 40028 85% - pp--format-list > 40028 85% - pp--insert > 38710 82% - pp--insert-lisp > 38710 82% - pp--format-list So, the current `pp' implementation is re-parsing from bob for every nested list inside sexp. This is quadratic scaling, and, as the repro demonstrates, the time goes up very quickly. Is the new option usable at all in practice? -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at