From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.bugs Subject: bug#63861: [PATCH] pp.el: New "pretty printing" code Date: Wed, 07 Jun 2023 16:19:38 +0000 Message-ID: <871qinme9q.fsf@posteo.net> References: <87edmnics1.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24827"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63861@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 07 18:25:21 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 1q6vyL-0006EW-1u for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 07 Jun 2023 18:25:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6vy9-0000Tn-Dy; Wed, 07 Jun 2023 12:25:09 -0400 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 1q6vy3-0000PQ-FQ for bug-gnu-emacs@gnu.org; Wed, 07 Jun 2023 12:25:03 -0400 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 1q6vy3-0006vW-3z for bug-gnu-emacs@gnu.org; Wed, 07 Jun 2023 12:25:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q6vy2-0006TC-No for bug-gnu-emacs@gnu.org; Wed, 07 Jun 2023 12:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Thierry Volpiatto Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Jun 2023 16:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63861 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-Cc: "Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors" , 63861@debbugs.gnu.org Original-Received: via spool by 63861-submit@debbugs.gnu.org id=B63861.168615509124841 (code B ref 63861); Wed, 07 Jun 2023 16:25:02 +0000 Original-Received: (at 63861) by debbugs.gnu.org; 7 Jun 2023 16:24:51 +0000 Original-Received: from localhost ([127.0.0.1]:54594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q6vxr-0006Sa-3V for submit@debbugs.gnu.org; Wed, 07 Jun 2023 12:24:51 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:55451) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q6vxm-0006S0-Om for 63861@debbugs.gnu.org; Wed, 07 Jun 2023 12:24:47 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id AE000240029 for <63861@debbugs.gnu.org>; Wed, 7 Jun 2023 18:24:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1686155080; bh=zSAxuZL1zaM9LfBN7PD/uPQ1qxQh/x/jOf/clHFMHn0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=UkBZW+fSqxJGYf7Rdxi1oE+iyxSRWZCTM+pFGVKUTIJIYVJ20M61AJ4pV9BdvUDlc DlOD6CMOnL412rT+HL333MbY2X9cGAHuE2Y06/yxQpeRWp5FNJp3ZY2k2MjdD+4kqR fSKz+Vezh4a7Ait1h8Bc5ua37Zs7vYAwnTQItSJ43UMSQKUM8cD5AIH4hMWdgZhlvl U2MwpzrQ8Sx7/5TGMhR6GR+DU0aZA7P68vR9HUDcvSPCE9gGw4/5ct95g2tyOB2kaC IPdW83dhtQka4C+RhYC5KvFzo+w4IWg0CQj3M4pTBfAHwZMjtbBAaRbLnzRASjA+Cc lvh8cvWbVJu9Q== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Qbt3C43Rcz9rxG; Wed, 7 Jun 2023 18:24:39 +0200 (CEST) In-reply-to: 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:263079 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Stefan Monnier writes: >> I tried your code and it looks very slow (but looks nice once printed). >> Testing on my bookmark-alist printed in some buffer. >> Here with a slightly modified version of pp-buffer (not much faster than >> the original one): >> >> (benchmark-run-compiled 1 (pp-buffer)) >> =3D> (6.942135047 0 0.0) >> And here with your version (using pp-region): >> (benchmark-run-compiled 1 (pp-buffer)) >> =3D> (46.141411097 0 0.0) >> >> For describe variable I use a modified version of `pp` which is very >> fast (nearly instant to pretty print value above) but maybe unsafe with >> some vars, didn't have any problems though, see >> https://github.com/thierryvolpiatto/emacs-config/blob/main/describe-vari= able.el. > > Beside the actual way we choose when to insert \n, the main difference > w.r.t performance tends to come from the fact that the new code relies > on `lisp-indent-line` rather than `lisp-indent-region`. > > In many cases it doesn't make much difference performancewise, but > indeed there are cases where the difference is significant (more > specifically where it makes the code O(N=C2=B2) rather than O(N)). > I've been using the patch below for a while and I should probably > include it the `pp-region` patch. > > Can you check whether it helps for your case? No, more or less the same: (benchmark-run-compiled 1 (pp-buffer)) =3D> (48.501764747 0 0.0) I have modified my code so that it can be used outside help, you can test it with tv/pp-region. Here with always the same test buffer: (benchmark-run-compiled 1 (tv/pp-region (point-min) (point-max))) =3D> (0.259444169 0 0.0) =2D-=20 Thierry --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHHBAEBCgAxFiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmSAr0ETHHRoaWV2b2xA cG9zdGVvLm5ldAAKCRAOxW0UHRbvkwp+C/wOxit5p0nawhL5sNdfj+v35T7KlKKh BuOxnG36W5q6IqApKN9VsRTEirFmWA7nyHAvlmN/VBPRIt1aZRdbsZX3tqQwWRYs taIU7EPxejnQs+rbdeRuTK5IvibjqHmPyg4bIbKV2WVgXbtJj7KXRBAZZrfDqq5u LhQv6Uqg46QQYfooZ1vW1jxaFb4wYTaSEeLHys3nmjQKEOQsdvgHz/rPn+TR6JEU 1LOAYHs52fxecgkuUt4Iu2FPpcyEcEbS/yFu9PEwTHl8jPAeB+IuJF0rcDkCF1E5 S1jcQ+AnmAYoQO2yxAHYihk+OSa2GTbFN1IsAEQyDSVwuL/5PBI1oHf81zAKAGMa nTCw0q62l6BMCGLNPrSf8Z9EgIqUMaWUzucQyVLlI3WQbCqRNNG2z31TuqWPgq/o wKVOMETJ+6HX6++DW0jzNR8Ek1btWxX2Kb6oC9GfmPBylvrZv3i5Z99d/2McCsq0 0noiry4Ic4HA8187gbW+R2W4AUGprZCnrJY= =h9Ln -----END PGP SIGNATURE----- --=-=-=--