From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id GApWFMDLUWPxWQEAbAwnHQ (envelope-from ) for ; Fri, 21 Oct 2022 00:29:20 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id uG+bFMDLUWPLhAEA9RJhRA (envelope-from ) for ; Fri, 21 Oct 2022 00:29:20 +0200 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 05A161E20C for ; Fri, 21 Oct 2022 00:29:20 +0200 (CEST) Received: from localhost ([::1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ole2R-0002Iu-5a for larch@yhetil.org; Thu, 20 Oct 2022 18:29:19 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oldwC-00080z-LA for larch@yhetil.org; Thu, 20 Oct 2022 18:22:52 -0400 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 1oldw2-0007wf-FZ for emacs-orgmode@gnu.org; Thu, 20 Oct 2022 18:22:45 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oldvz-0006rE-So for emacs-orgmode@gnu.org; Thu, 20 Oct 2022 18:22:41 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id F25F3240103 for ; Fri, 21 Oct 2022 00:22:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1666304556; bh=UQuiy27Unu5VV/K7RKjXOypD75RIRY2YrNtBRSW/Dkc=; h=From:To:Subject:Date:Autocrypt:OpenPGP:From; b=lLjFLDxMcIK+8RVfHzjxs5zjfsK+1i2HRK2g/a8N8ys9h5RpOf689ckyiraEof6Ih up9sIlL0RRe125jG36LbbHiNYNrrwUJy85kI4/ma2Ed1GNg5zJpUGfZ53KloJA0CUi bvT2Z7r2KTPyaJ4joDJ5HAmGod0JIF/QukOfWkW/DnIGTalgqZoQkBgJEmeCYi73F4 rTXv/RWZPIX1DWk5XHa+FPTbpXdeG/sAps0ijuIfDM6Y1038NU2iCnIHwoSFOyyDcJ /N3Rk0uFFowErI14pVfvK/21pHQEhTTtnabgLVFyeYBuA8StqQ/M00SemcdQ2G02P5 cV/vqy2Hm0CtA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MthtL3j6Jz9rxH for ; Fri, 21 Oct 2022 00:22:34 +0200 (CEST) From: Michael Eliachevitch To: Org Mode Subject: org-persist-write slow when pp-use-max-width is t Date: Thu, 20 Oct 2022 21:46:07 +0000 Message-ID: <87o7u6t9sm.fsf@posteo.de> MIME-Version: 1.0 Content-Type: text/plain; format=flowed Autocrypt: addr=m.eliachevitch@posteo.de; keydata=xsBNBFHFxZABCADAAv2siayhA7Etl85WcwcyMPBD2bt/6Wh3A8a12AURV5J4tprzgbdlxC0w1LofvklG7ls25NERAY931hvQW+f5GEI0pwoNNFXEkKDa8/J4SxhrqXx8CJA85owPq1g4cFeO1ooQJ32BewlRGsnhd+taYExZ76oaMnFtx6jYjf6mPbjDyiLhC+Og3MBpOqAnmX7mhStgJl0uru1ZGEB17tzzVuQ4ljDv/MvUagVFymQBhmlbzvze5eLeDn90Ot0DjWHy3HzCFMEnVqQy8rmEA8N9GOANwyMY79KV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QDjIpw/chHQGeYWJneSdEDsbWM76yCyLF1adaccBAiHWKUTRIN5m74+xc/ZsTMCDdxaplklfeYUwwtnJ6HfW2Ia91s+4RuhdGd42kidf+3a7cTGHVn8aKKXLlteTFBeOZGnWl48dSQBC09rpq6DUOJPkmSPo3tMCYFSUyNZe7ebKNfU3P4PNreZoG4rDVkWBqNKu986WQOoYc2O0OspbC7JXrk0wiGMQKWWOW3Gw OpenPGP: url=https://posteo.de/keys/m.eliachevitch@posteo.de.asc Received-SPF: pass client-ip=185.67.36.66; envelope-from=m.eliachevitch@posteo.de; helo=mout02.posteo.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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.29 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-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1666304960; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature:openpgp:openpgp:autocrypt:autocrypt; bh=/cCsb6KaQ1MST2W5BN+4KrYVuN4+uvI/U3Ob2QDxx7E=; b=KfVaWv2NGD3X145ryadnqtlLCOGSFPTVWjHLPykrT34lhF3n2pt2b4OZjGfmRAj8RwAIan C/vRxi4UOVFjZi1aTmSrCmz+bsjdpgGOHBykgOZM9WwqPo8/2hyoIweqiBJJB4UvVTbfGq G4sRmDWEZemNv+bp+sJa8ytohkiV8uxYnM3xiZpPNe8L2DitoEJKkMn+7p6bhzFI+bjICS DRzqqjuRDHI/FCB5TndMNx3mETA+A6st/dOfNpu3vSL5FsK0AassNh9keQLJBg6g0LT64K JM1j+AVDbhp9m/NjWj/+Gpmhn/GA5wMVkoXIf8FJ/iDcWyZFsgb6KR59LT3d+w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666304960; a=rsa-sha256; cv=none; b=cZai8OI3s4hVLfU5fIT/YwrbNlHxkQL2bMAxiCGqt2yj4EZ773Cc+Gc8Dkxm/9G3rsqa6/ yGdkc1SFafMldoQSuumTAsFfnf5fSZerVMrkJnh0XR66U1qlQdAE1iTXS9RKq1Fq5dEfmN 81N0w/MoW9gv9/6umvtvlNNmYF493npMmEU1cp+28wQR/JTqk78vPztMfA288XZIs8w6pq IbLQYJV2EKrmKZV3DoIJXoH84s11sS3Nj47rkT+xqD6xzD8DoZk3FQdWzXTtvmvN9+Q+Mr W6Zk6T1QBET4mslLnGMf+EX79JY5sIhi2S2siHfMAozkXa0+PfqGNJsTIagaWQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.de header.s=2017 header.b=lLjFLDxM; dmarc=pass (policy=none) header.from=posteo.de; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.73 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.de header.s=2017 header.b=lLjFLDxM; dmarc=pass (policy=none) header.from=posteo.de; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 05A161E20C X-Spam-Score: -5.73 X-Migadu-Scanner: scn0.migadu.com X-TUID: NFoR3l4SxgWG I was wondering why kill-emacs emacs takes over a minute and after some profiling I found out that the call to org-persist-write-all takes long when pp-use-max-width is set to t and pp-max-width is also set (in my case to t, the window-width), which enables line folding in pp. The pp-call happens in org-persist--write-elisp-file when it is called by org-persist-write:index with the pp-parameter set to t. Maybe it's clearer with the following excerpt of my CPU-profile: 38009 96% - org-persist-write-all 38009 96% - org-persist-write 37703 95% - mapcar 37703 95% - # 37703 95% - org-persist-write:index 37703 95% - org-persist--write-elisp-file 37703 95% - pp 37703 95% - pp-to-string 37703 95% - pp-emacs-lisp-code 37687 95% + pp--insert-lisp Setting pp-use-max-width to nil made the function call almost instantanteous. I had enabled pp-use-max-width in the past when pretty-printing the results of interactive elisp sessions (like pp-eval-last-sexp). I didn't think this would affect how other packages would save their data and I didn't expect this would result in such a performance hit. Possibly this is not an issue with org-mode or pp but just my own mistake of not being aware that pp is used as a library by other packages and thus customizing its behaviour has global effects. Not sure if the org mailing list is the best place to report this observation. What org could do is to use a let-binding to temporarily set pp-use-max-width to nil to disable line folding. Or do you think that some users might care that their cache files are formatted prettily according to their customization options? If you think this is not an issue with org-mode, maybe I/we could forward this to the pp-maintainers, as it's in emacs core possibly to emacs-devel? I think at least a warning in the variable documentation about performance hits might have been helpful. Best regards, Michael Eliachevitch