GNU logs - #68072, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#68072: pp functions have O(n^2) runtime with lisp-indent-function set to common-lisp-indent-function
Resent-From: Brennan Vincent <brennan@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 28 Dec 2023 00:11:02 +0000
Resent-Message-ID: <handler.68072.B.17037222473736 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 68072
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 68072 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.17037222473736
          (code B ref -1); Thu, 28 Dec 2023 00:11:02 +0000
Received: (at submit) by debbugs.gnu.org; 28 Dec 2023 00:10:47 +0000
Received: from localhost ([127.0.0.1]:38084 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rIdz5-0000yC-Fo
	for submit <at> debbugs.gnu.org; Wed, 27 Dec 2023 19:10:47 -0500
Received: from lists.gnu.org ([2001:470:142::17]:38596)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <brennan@HIDDEN>) id 1rIdz3-0000xy-Hj
 for submit <at> debbugs.gnu.org; Wed, 27 Dec 2023 19:10:46 -0500
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 <brennan@HIDDEN>)
 id 1rIdyy-0001qC-Ic
 for bug-gnu-emacs@HIDDEN; Wed, 27 Dec 2023 19:10:40 -0500
Received: from smtp.umanwizard.com ([54.203.248.109])
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <brennan@HIDDEN>) id 1rIdyv-0002zA-Dr
 for bug-gnu-emacs@HIDDEN; Wed, 27 Dec 2023 19:10:40 -0500
Received: from localhost ([173.205.212.102]) by smtp.umanwizard.com ;
 28 Dec 2023 00:10:32 +0000
X-Fes-Received-For: bug-gnu-emacs@HIDDEN
X-Fes-Received-From: <brennan@HIDDEN>
From: Brennan Vincent <brennan@HIDDEN>
Date: Wed, 27 Dec 2023 19:10:28 -0500
Message-ID: <875y0jw5jf.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Fes-Encrypted: true
X-Fes-Ehlo-Domain: localhost
Received-SPF: pass client-ip=54.203.248.109;
 envelope-from=brennan@HIDDEN; helo=smtp.umanwizard.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

This also causes eglot (in its default configuration) to hang when
opening large Rust files, since rust-analyzer tends to send large amounts of
inlay hints, and eglot logs the messages it receives as pretty-printed
lisp objects.

Note the times in the comments here, showing clearly quadratic behavior:

(setq lisp-indent-function  'common-lisp-indent-function)

(defun bm1 (sz)
  (car
   (benchmark-run (progn (setq p (pp-to-string (make-list sz 'foo))) nil))))

(bm1 1000) ;; 0.057078079
(bm1 2000) ;; 0.22562238599999998
(bm1 10000) ;; 5.312058368
(bm1 20000) ;; 21.00088354






Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Brennan Vincent <brennan@HIDDEN>
Subject: bug#68072: Acknowledgement (pp functions have O(n^2) runtime with
 lisp-indent-function set to common-lisp-indent-function)
Message-ID: <handler.68072.B.17037222473736.ack <at> debbugs.gnu.org>
References: <875y0jw5jf.fsf@HIDDEN>
X-Gnu-PR-Message: ack 68072
X-Gnu-PR-Package: emacs
Reply-To: 68072 <at> debbugs.gnu.org
Date: Thu, 28 Dec 2023 00:11:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 68072 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
68072: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D68072
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#68072: pp functions have O(n^2) runtime with lisp-indent-function set to common-lisp-indent-function
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 28 Dec 2023 06:24:02 +0000
Resent-Message-ID: <handler.68072.B68072.17037446211136 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 68072
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Brennan Vincent <brennan@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
Cc: 68072 <at> debbugs.gnu.org
Received: via spool by 68072-submit <at> debbugs.gnu.org id=B68072.17037446211136
          (code B ref 68072); Thu, 28 Dec 2023 06:24:02 +0000
Received: (at 68072) by debbugs.gnu.org; 28 Dec 2023 06:23:41 +0000
Received: from localhost ([127.0.0.1]:38276 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rIjnw-0000IG-Ga
	for submit <at> debbugs.gnu.org; Thu, 28 Dec 2023 01:23:40 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:55222)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1rIjnu-0000I3-Kf
 for 68072 <at> debbugs.gnu.org; Thu, 28 Dec 2023 01:23:39 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1rIjnp-0004Px-Mp; Thu, 28 Dec 2023 01:23:33 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=0tZ4UIpbywBhNTBn7Bve5wOsy+DrWyEUOSAbn7RjuSU=; b=cQ0blSiEaxul
 scbLIF+ZAb9fmRAFqPqMqlrc3PQSxZuvRVeUQdpTvzmSPMLaMxIbBPPHVHlcawH0jCHd2r1NsaNAw
 6YBjqkhtslC78bJGt/h5nyhQWC412TW6v6lWeU5VgjpTe4cVegw3bCibPZ5Awko2f5WzHhG9JSGvw
 /XNpxYIEQqezZ2j6VLBqBbwncpJHi3NVC+O/gvIK3M/WxtykpIsHJKbkIOnlW/vDpgi4i5ZI0uYW9
 WfsXDIR0vdG2RYlNAlgLjB6dHWAFbMmq/Rt+Qe0lPIXr5qvLrBoYVatR1dEZV9guR7MHihp1HHleT
 KpGYNkF1Qh2CFgSwkliTPw==;
Date: Thu, 28 Dec 2023 08:23:19 +0200
Message-Id: <83a5pu976w.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <875y0jw5jf.fsf@HIDDEN> (message
 from Brennan Vincent on Wed, 27 Dec 2023 19:10:28 -0500)
References: <875y0jw5jf.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Brennan Vincent <brennan@HIDDEN>
> Date: Wed, 27 Dec 2023 19:10:28 -0500
> 
> This also causes eglot (in its default configuration) to hang when
> opening large Rust files, since rust-analyzer tends to send large amounts of
> inlay hints, and eglot logs the messages it receives as pretty-printed
> lisp objects.
> 
> Note the times in the comments here, showing clearly quadratic behavior:
> 
> (setq lisp-indent-function  'common-lisp-indent-function)
> 
> (defun bm1 (sz)
>   (car
>    (benchmark-run (progn (setq p (pp-to-string (make-list sz 'foo))) nil))))
> 
> (bm1 1000) ;; 0.057078079
> (bm1 2000) ;; 0.22562238599999998
> (bm1 10000) ;; 5.312058368
> (bm1 20000) ;; 21.00088354

Adding Stefan to the discussion.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#68072: pp functions have O(n^2) runtime with lisp-indent-function set to common-lisp-indent-function
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 28 Dec 2023 07:21:02 +0000
Resent-Message-ID: <handler.68072.B68072.170374802514859 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 68072
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Brennan Vincent <brennan@HIDDEN>
Cc: 68072 <at> debbugs.gnu.org
Received: via spool by 68072-submit <at> debbugs.gnu.org id=B68072.170374802514859
          (code B ref 68072); Thu, 28 Dec 2023 07:21:02 +0000
Received: (at 68072) by debbugs.gnu.org; 28 Dec 2023 07:20:25 +0000
Received: from localhost ([127.0.0.1]:38316 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rIkgq-0003rb-R8
	for submit <at> debbugs.gnu.org; Thu, 28 Dec 2023 02:20:25 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:3322)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1rIkgp-0003rP-Dl
 for 68072 <at> debbugs.gnu.org; Thu, 28 Dec 2023 02:20:24 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 7D276440550;
 Thu, 28 Dec 2023 02:20:18 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1703748017;
 bh=/oMy9Lb1tBBqN3A1kqXp/K4QFQ1zNz2t9zOiUlmxFfI=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=LUP6G5eefAn6A25NK2Enb+C2tGleQXLkHLoAdijH9RgQXCZ2q0ld10kN5DWdWkHYq
 mO7bpc2YkeSuVevQQvlNKi2oHxrBc9v1i3+ecbrPuc5YGD0A/wOKSN/V8chrjSmEUs
 8ENgc4ac/l+1c0f9Hy+/OKXA8iX9ZpxPDqIYXZ8SN1lZTdFZ/HIjjQZxh/8wXC4QZ0
 MwEWjy+O+WjQoCE0tZUBp0lFQNiVfEkxFXUkXJT3Ll9y/cwPbXLlRQgLPlSB0bKoiD
 IY1q8kvDoosGkQIKdCdgoisdjA/mZdG7uCk1q46EX7MX2hCu1fybOoAAShczVb8wHe
 R7GnkGzJowMhw==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 31B3144052C;
 Thu, 28 Dec 2023 02:20:17 -0500 (EST)
Received: from pastel (65-110-221-238.cpe.pppoe.ca [65.110.221.238])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id F2007120D36;
 Thu, 28 Dec 2023 02:20:16 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <875y0jw5jf.fsf@HIDDEN> (Brennan
 Vincent's message of "Wed, 27 Dec 2023 19:10:28 -0500")
Message-ID: <jwvh6k2g5yd.fsf-monnier+emacs@HIDDEN>
References: <875y0jw5jf.fsf@HIDDEN>
Date: Thu, 28 Dec 2023 02:20:16 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.203 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

I can definitely agree: `pp` using the default `pp-default-function`
(i.e. `pp-fill`) is *not* a good idea if you have changed
`lisp-indent-function` (unless you changed it to a faster function, of
course).  We may be able to fix this O(N=B2) behavior, but the underlying
principle stands: it's much too easy to fall into another O(N=B2) behavior.

> This also causes eglot (in its default configuration) to hang when
> opening large Rust files, since rust-analyzer tends to send large amounts=
 of
> inlay hints, and eglot logs the messages it receives as pretty-printed
> Lisp objects.

And Eglot should probably use a faster pretty printer than the default
`pp` for that.  Maybe we should make `lisp-data-mode` set
`pp-default-function` or `lisp-indent-function` to avoid such problems?


        Stefan





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#68072: pp functions have O(n^2) runtime with lisp-indent-function set to common-lisp-indent-function
Resent-From: Brennan Vincent <brennan@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 28 Dec 2023 15:38:01 +0000
Resent-Message-ID: <handler.68072.B68072.17037778519756 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 68072
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Stefan Monnier <monnier@HIDDEN>, 68072 <at> debbugs.gnu.org
Received: via spool by 68072-submit <at> debbugs.gnu.org id=B68072.17037778519756
          (code B ref 68072); Thu, 28 Dec 2023 15:38:01 +0000
Received: (at 68072) by debbugs.gnu.org; 28 Dec 2023 15:37:31 +0000
Received: from localhost ([127.0.0.1]:40186 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rIsRu-0002XH-Ks
	for submit <at> debbugs.gnu.org; Thu, 28 Dec 2023 10:37:30 -0500
Received: from smtp.umanwizard.com ([54.203.248.109]:35916)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <brennan@HIDDEN>) id 1rIsRr-0002X0-JK
 for 68072 <at> debbugs.gnu.org; Thu, 28 Dec 2023 10:37:29 -0500
Received: from localhost ([173.205.212.102]) by smtp.umanwizard.com ;
 28 Dec 2023 15:37:13 +0000
X-Fes-Received-For: 68072 <at> debbugs.gnu.org
X-Fes-Received-From: <brennan@HIDDEN>
From: Brennan Vincent <brennan@HIDDEN>
In-Reply-To: <jwvh6k2g5yd.fsf-monnier+emacs@HIDDEN>
References: <875y0jw5jf.fsf@HIDDEN>
 <jwvh6k2g5yd.fsf-monnier+emacs@HIDDEN>
Date: Thu, 28 Dec 2023 10:37:09 -0500
Message-ID: <8734vmwd7e.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Fes-Encrypted: true
X-Fes-Ehlo-Domain: localhost
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Stefan Monnier <monnier@HIDDEN> writes:

> I can definitely agree: `pp` using the default `pp-default-function`
> (i.e. `pp-fill`) is *not* a good idea if you have changed
> `lisp-indent-function` (unless you changed it to a faster function, of
> course).  We may be able to fix this O(N=C2=B2) behavior, but the underly=
ing
> principle stands: it's much too easy to fall into another O(N=C2=B2) beha=
vior.
>

Thanks for the tip and I can definitely remove the customization of
lisp-indent-function to common-lisp-indent-function. I actually don't
remember why I originally set it since I don't write common lisp... but
anyway, if we don't expect changing lisp-indent-function globally to
behave nicely with other features (like pp), perhaps
lisp-indent-function shouldn't be Customize-able , or we should at least
mention this in the documentation?

>> This also causes eglot (in its default configuration) to hang when
>> opening large Rust files, since rust-analyzer tends to send large amount=
s of
>> inlay hints, and eglot logs the messages it receives as pretty-printed
>> Lisp objects.
>
> And Eglot should probably use a faster pretty printer than the default
> `pp` for that.  Maybe we should make `lisp-data-mode` set
> `pp-default-function` or `lisp-indent-function` to avoid such problems?
>
>
>         Stefan





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#68072: pp functions have O(n^2) runtime with lisp-indent-function set to common-lisp-indent-function
Resent-From: Stefan Kangas <stefankangas@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 28 Dec 2023 17:11:01 +0000
Resent-Message-ID: <handler.68072.B68072.170378343514987 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 68072
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Stefan Monnier <monnier@HIDDEN>, Brennan Vincent <brennan@HIDDEN>
Cc: 68072 <at> debbugs.gnu.org
Received: via spool by 68072-submit <at> debbugs.gnu.org id=B68072.170378343514987
          (code B ref 68072); Thu, 28 Dec 2023 17:11:01 +0000
Received: (at 68072) by debbugs.gnu.org; 28 Dec 2023 17:10:35 +0000
Received: from localhost ([127.0.0.1]:40246 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rIttz-0003te-Am
	for submit <at> debbugs.gnu.org; Thu, 28 Dec 2023 12:10:35 -0500
Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]:59885)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1rIttx-0003tJ-DM
 for 68072 <at> debbugs.gnu.org; Thu, 28 Dec 2023 12:10:34 -0500
Received: by mail-lf1-x135.google.com with SMTP id
 2adb3069b0e04-50e7c6e3c63so3000612e87.3
 for <68072 <at> debbugs.gnu.org>; Thu, 28 Dec 2023 09:10:33 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1703783428; x=1704388228; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=1G0HtDTpQ+oceP+R1MRvkp5fmrR75+ZRW25PHUCRNrE=;
 b=ETNH/nYYMAfm4XmIHYSJ0eUmY3pCltH4fM+6NSwrc+7Sh5FSUfS6J4JxfZ2f0gLd42
 2ASE7JeQeXekXKxX7DAhp7We6kK9Zk58e3M4SuTkRJCmApKdl6SnjS0wywOdMsdKn3A7
 9lm5joEBnzYEVmnuOJq/fK8LmfybXpmJHhSluU7vCayZeECmFtH8Bl5C3u1QVtRyDNJw
 Yr7jJt+hkaYJQY07rqX0e9n8yamsoZ7rlcgRP/t/fLZ4p8TuxvGFK207shwPg3KZR9cp
 o1lKvtW3EjyrFXv3MjZdaTQUOvI811fyvRTcs2+3rRTTm3hOFHZ9MYH/sPE4x+YdkFl7
 CVig==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1703783428; x=1704388228;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=1G0HtDTpQ+oceP+R1MRvkp5fmrR75+ZRW25PHUCRNrE=;
 b=nH6USd7DMlTJ6upchg8pvFX1WuUWZO+xd9x17UJDREvsB1fWv04mURtbKCplqOiXLm
 ELuoegcYduLjA8bungKeGLHfuBwPou+V6IRZT8k8LiUmYPz/Ckvzmh0IsjqboLKNQFll
 XlyrdR1z0Cf5iUtCiJN/tcLErQRp3Hb5tSr/Y6qn6ehs7SL/qOWjjhcVLuWOtB3VShAA
 2a9wseIVX0gz3C9Xo9QyX9isVrB34MhqHlVfTMDLIEdTJP7nLx9nYj5cWTCzF3XItClC
 /+E/CKW16u9Xbi8HEBcgeZ9xGlDsdMO8wshNEMAFnlfk4Usx8y6qMhKLaMRlOYj/s/OZ
 2VJw==
X-Gm-Message-State: AOJu0YxhHph2abfAjB4Xy2oq3K2q1jEi4LtdB7r7IQGOAFLvOaDSVxU+
 b/wyMug4zUU6EsPbmSIzOW3ixGXMDvIT8K0wD3I=
X-Google-Smtp-Source: AGHT+IEPK7GjX4U0pan4SuzB0POZNGfrxu/6sfkLQMRR/FU3PkEWPDSsFZUy51eOAEgvly3fmkHIg73B7el5dvVculQ=
X-Received: by 2002:a05:6512:3c8e:b0:50e:76a4:4e13 with SMTP id
 h14-20020a0565123c8e00b0050e76a44e13mr2130718lfv.119.1703783427451; Thu, 28
 Dec 2023 09:10:27 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Thu, 28 Dec 2023 09:10:27 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <jwvh6k2g5yd.fsf-monnier+emacs@HIDDEN>
References: <875y0jw5jf.fsf@HIDDEN>
 <jwvh6k2g5yd.fsf-monnier+emacs@HIDDEN>
MIME-Version: 1.0
Date: Thu, 28 Dec 2023 09:10:27 -0800
Message-ID: <CADwFkmmO_Xy+DP6io48TcUWZmSTShL9ao4aVJY5v2xX9zj-jTA@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

> Maybe we should make `lisp-data-mode` set `pp-default-function` or
> `lisp-indent-function` to avoid such problems?

It sounds like a good idea.  This problem is presumably not at all
limited to eglot, and this should fix it for any case using
`lisp-data-mode`.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#68072: pp functions have O(n^2) runtime with lisp-indent-function set to common-lisp-indent-function
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 05 Jan 2024 03:52:02 +0000
Resent-Message-ID: <handler.68072.B68072.17044266678784 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 68072
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= <joaotavora@HIDDEN>
Cc: Brennan Vincent <brennan@HIDDEN>, 68072 <at> debbugs.gnu.org
Received: via spool by 68072-submit <at> debbugs.gnu.org id=B68072.17044266678784
          (code B ref 68072); Fri, 05 Jan 2024 03:52:02 +0000
Received: (at 68072) by debbugs.gnu.org; 5 Jan 2024 03:51:07 +0000
Received: from localhost ([127.0.0.1]:56116 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rLbEh-0002Ha-7l
	for submit <at> debbugs.gnu.org; Thu, 04 Jan 2024 22:51:07 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:36018)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1rLbEe-0002H3-6Q
 for 68072 <at> debbugs.gnu.org; Thu, 04 Jan 2024 22:51:06 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C3877440A71;
 Thu,  4 Jan 2024 22:50:53 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1704426652;
 bh=QaDqDVTEYp8TKqg6w8CFfVxO61u/xpFRhOoh/e7qBxA=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=TdFfxFzmQC31ze0qtgiscal8vj0fIN+pU40B0vmot4Dx2FmQqVJACP6XX5+Cu186A
 mmTPMiqauhIPnRaAGzcSTNmKSJ7L7Y0O3O9rXmo6ap6rGZhIP9xA6y2HlAksOZry5Z
 7zFYiLz6lD6t7k53ETYpEbTwLmXOqsbe7ofyMMYuMY3r2PnAxlovWBkucaaK4ITXcX
 TsEKsbkQuOwEXZ00j5wvsyqcOFPqwi1zmsroGJDLhH5Fcx6JB0jEQdsqaL3SoNjp3w
 CozJkfC2KlnJ47EoAfeQMlFd14rpUOo16JqNHev1TkYMzp1icXCvTsjYZqCHyw8RuH
 tQMPKUldhQyWQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 65E6644092E;
 Thu,  4 Jan 2024 22:50:52 -0500 (EST)
Received: from pastel (65-110-221-238.cpe.pppoe.ca [65.110.221.238])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 36CF21203CD;
 Thu,  4 Jan 2024 22:50:52 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <jwvh6k2g5yd.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Thu, 28 Dec 2023 02:20:16 -0500")
Message-ID: <jwvr0iw4f32.fsf-monnier+emacs@HIDDEN>
References: <875y0jw5jf.fsf@HIDDEN>
 <jwvh6k2g5yd.fsf-monnier+emacs@HIDDEN>
Date: Thu, 04 Jan 2024 22:50:51 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.178 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> And Eglot should probably use a faster pretty printer than the default
> `pp` for that.  Maybe we should make `lisp-data-mode` set
> `pp-default-function` or `lisp-indent-function` to avoid such problems?

Jsonrpc uses the pretty printer via `pp-to-string` so there's no major
mode to change (and `pp-to-string` isn't told whether it's printing code
or data =F0=9F=99=81), and in order to run on older Emacsen it can't really=
 use
the `pp-function` argument either.

So in the mean time, maybe the patch below is in order?
Jo=C3=A3o, any comment?


        Stefan


diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index 3f33443f321..f0f5842a0ee 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -1011,7 +1010,9 @@
                        (format "%s%s" preamble
                                (or (and foreign-message
+                                    (let ((lisp-indent-function ;bug#68072
+                                           #'lisp-indent-function))
                                         (concat "\n" (pp-to-string
-                                                      foreign-message)))
+                                                    foreign-message))))
                                    (concat log-text "\n")))))))
           (goto-char (point-max))





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#68072: pp functions have O(n^2) runtime with lisp-indent-function set to common-lisp-indent-function
Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= <joaotavora@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 05 Jan 2024 13:07:02 +0000
Resent-Message-ID: <handler.68072.B68072.170446001614608 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 68072
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Stefan Monnier <monnier@HIDDEN>
Cc: Brennan Vincent <brennan@HIDDEN>, 68072 <at> debbugs.gnu.org
Received: via spool by 68072-submit <at> debbugs.gnu.org id=B68072.170446001614608
          (code B ref 68072); Fri, 05 Jan 2024 13:07:02 +0000
Received: (at 68072) by debbugs.gnu.org; 5 Jan 2024 13:06:56 +0000
Received: from localhost ([127.0.0.1]:56658 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rLjua-0003nY-BU
	for submit <at> debbugs.gnu.org; Fri, 05 Jan 2024 08:06:56 -0500
Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]:49433)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1rLjuX-0003nI-4f
 for 68072 <at> debbugs.gnu.org; Fri, 05 Jan 2024 08:06:55 -0500
Received: by mail-lj1-x22e.google.com with SMTP id
 38308e7fff4ca-2ccbc328744so18555131fa.3
 for <68072 <at> debbugs.gnu.org>; Fri, 05 Jan 2024 05:06:48 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1704460002; x=1705064802; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=2kPt3HH27gHLJDN/y/mE7SneNvmWoTuTd6eSDwHjkBA=;
 b=a3FCghSnlPCXddXlDx9fzHt4SapQsyHDhKOcLVGMEfM65VVPSzgncnUB5corsslJCm
 og1YFcICFJLRqxuEc7EPYeVISMftr4bZgV9ju7qK5n4eNVUb0CVry7SbMSvk6j8Y/x2C
 DCq5GWrq5cyRR6KfN+Qq4xVPWYvNHWkgfosWBrbzuVeZ2Y5I31ohefmA7BWW6MwXsO14
 8pGEvweKepqCivDFKsrgeywOQWb3eYLgfYN6phdM88/EdxSmpHPXHwh3qgcEXuZdRbky
 AyebDq6wxGfupzPJ33Hi6FPaQbic0XcEBVYGSXv2PkaWHgwPE8pzs0umG+Yyrdmgieo6
 meyA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1704460002; x=1705064802;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=2kPt3HH27gHLJDN/y/mE7SneNvmWoTuTd6eSDwHjkBA=;
 b=QOn3NDN3jzBo5mB5WeqjD/Zo7/pQHCjmbgvrRfKHhC2lrQ2ruPNiL+gMK7g7SseCd1
 bMjmdqo7mCvmjLtMfWoMmGaVl5PHefnNOhbVlI2TSCw64bwcB7Hd77Qiaj7Bo94TI3AC
 Xmj8mcqahRCOIChS6ePNkgWJZOy58ivObrxR/g53PtVwUIB2Y6Fh+j7/B2f3a+cG+6o5
 qnTZVpDTPKX1CP3NcbJOtKPhykX8EToGTbCIrWbUL782kqbvxNdc7DsEz6pW+aXDzJlB
 I2OiewHVGg7rpnUUy5k9tXZ01513om5MIjPBcYF39GlifzzfucFqftPaxOEna8KhMQ8+
 +GfQ==
X-Gm-Message-State: AOJu0YwCbkdGExpBySFRtvxI/11yWuvqi1h/BV5w9qSvT4phLyvSlFgU
 br8BoF+WyD3/OeHtORm8ZoFa4JCCbKgLeElQ2uRlWIx0m6Y=
X-Google-Smtp-Source: AGHT+IFChWUS31TmZnJcvp2vFYO/ZKiaR8r+KsNBrAIe+ejTezT41K3kGzKAGhmAtcDjAN1hz67B5XWqXJJ8nVPsWYU=
X-Received: by 2002:a05:651c:14a:b0:2cc:89f4:15a3 with SMTP id
 c10-20020a05651c014a00b002cc89f415a3mr1046508ljd.49.1704460001929; Fri, 05
 Jan 2024 05:06:41 -0800 (PST)
MIME-Version: 1.0
References: <875y0jw5jf.fsf@HIDDEN>
 <jwvh6k2g5yd.fsf-monnier+emacs@HIDDEN>
 <jwvr0iw4f32.fsf-monnier+emacs@HIDDEN>
In-Reply-To: <jwvr0iw4f32.fsf-monnier+emacs@HIDDEN>
From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= <joaotavora@HIDDEN>
Date: Fri, 5 Jan 2024 13:06:30 +0000
Message-ID: <CALDnm50i=nz4VOhHJgikEUNjpD86vkJhDmW0yjsDDq-kYnV6FQ@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Fri, Jan 5, 2024 at 3:50=E2=80=AFAM Stefan Monnier <monnier@HIDDEN=
l.ca> wrote:
>
> > And Eglot should probably use a faster pretty printer than the default
> > `pp` for that.  Maybe we should make `lisp-data-mode` set
> > `pp-default-function` or `lisp-indent-function` to avoid such problems?
>
> Jsonrpc uses the pretty printer via `pp-to-string` so there's no major
> mode to change (and `pp-to-string` isn't told whether it's printing code
> or data =F0=9F=99=81), and in order to run on older Emacsen it can't real=
ly use
> the `pp-function` argument either.
>
> So in the mean time, maybe the patch below is in order?
> Jo=C3=A3o, any comment?

Maybe, I think so.

Though the starting premise of this bug:

> This also causes eglot (in its default configuration) to hang when
> opening large Rust files, since rust-analyzer tends to send large amounts=
 of
> inlay hints, and eglot logs the messages it receives as pretty-printed
> lisp objects.

Is not true anymore, starting around the time Brennan opened it.
Eglot now uses JSON by default, which should solve most of the
performance  issues related to logging.

But Lisp pp is still opt-in, and making it faster (and relatively
pretty) is a good thing.

Jo=C3=A3o




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#68072: pp functions have O(n^2) runtime with lisp-indent-function set to common-lisp-indent-function
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 07 Jan 2024 05:08:02 +0000
Resent-Message-ID: <handler.68072.B68072.170460407710379 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 68072
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= <joaotavora@HIDDEN>
Cc: Brennan Vincent <brennan@HIDDEN>, 68072 <at> debbugs.gnu.org
Received: via spool by 68072-submit <at> debbugs.gnu.org id=B68072.170460407710379
          (code B ref 68072); Sun, 07 Jan 2024 05:08:02 +0000
Received: (at 68072) by debbugs.gnu.org; 7 Jan 2024 05:07:57 +0000
Received: from localhost ([127.0.0.1]:60549 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rMLO8-0002hL-Jr
	for submit <at> debbugs.gnu.org; Sun, 07 Jan 2024 00:07:56 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:31156)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1rMLO5-0002h7-Sc
 for 68072 <at> debbugs.gnu.org; Sun, 07 Jan 2024 00:07:55 -0500
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id EA20110009E;
 Sun,  7 Jan 2024 00:07:42 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1704604057;
 bh=MKLRs2ZmfuT8F4pkk1I6DrhoE24EeSeHjen/DTo3W2M=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=Vp07oc9+7I5tT5eS0kWR9mHPq4KIP0iC6RqNwt0NeNe49t7SjmYPnGm9csiD+BHkc
 Zjj4ulHhd4CeK2D1eLJP0BbJHjFEKy+85wA/wmWUSYHCeQX9GD6LNy2yzARjaHcpr5
 kzha3AciI70D058Nvz9WPyjkOtm2/g58o+Qg1GVK/PuS8VSEje4AvqcdcKnWpO3zZg
 ch7zxot4j157BjED2bhW0b7aH3QhXNDWJUz14G63sb0WpVRMEsjpGhRet91FMO1Q86
 XkLXuDfWgLyb3JlSoAPrnI5GW4Rqo7Eb9j1cWcni07uJqwxUKVktN4HwDJNCE0dmXn
 crC+7sFQyEBIQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 6A90710004C;
 Sun,  7 Jan 2024 00:07:37 -0500 (EST)
Received: from pastel (65-110-221-238.cpe.pppoe.ca [65.110.221.238])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 31C12120BBF;
 Sun,  7 Jan 2024 00:07:37 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <CALDnm50i=nz4VOhHJgikEUNjpD86vkJhDmW0yjsDDq-kYnV6FQ@HIDDEN>
 ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Fri, 5 Jan 2024
 13:06:30 +0000")
Message-ID: <jwvfrz94ty3.fsf-monnier+emacs@HIDDEN>
References: <875y0jw5jf.fsf@HIDDEN>
 <jwvh6k2g5yd.fsf-monnier+emacs@HIDDEN>
 <jwvr0iw4f32.fsf-monnier+emacs@HIDDEN>
 <CALDnm50i=nz4VOhHJgikEUNjpD86vkJhDmW0yjsDDq-kYnV6FQ@HIDDEN>
Date: Sun, 07 Jan 2024 00:07:24 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.270 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> So in the mean time, maybe the patch below is in order?
>> Jo=E3o, any comment?
>
> Maybe, I think so.

OK, pushed, thanks.

> Though the starting premise of this bug:
>> This also causes eglot (in its default configuration) to hang when
>> opening large Rust files, since rust-analyzer tends to send large amount=
s of
>> inlay hints, and eglot logs the messages it receives as pretty-printed
>> lisp objects.
> Is not true anymore, starting around the time Brennan opened it.
> Eglot now uses JSON by default, which should solve most of the
> performance  issues related to logging.

I assumed that Brennan had changed the format to `lisp`.

> But Lisp pp is still opt-in, and making it faster (and relatively
> pretty) is a good thing.

The `pp` code would really benefit from extra info about what kind of
"pp" is desired (are we prettifying ELisp code or just some arbitrary
data?  Do we really want to be pretty for a human reader or do we just
want something printed quickly but a bit more manageable than a single
super-long line?).


        Stefan






Last modified: Sat, 20 Jan 2024 12:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.