GNU bug report logs - #36566
27.0.50; debug is sometimes horribly slow

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Michael Heerdegen <michael_heerdegen@HIDDEN>; dated Wed, 10 Jul 2019 03:10:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 14 Sep 2019 15:47:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 11:47:44 2019
Received: from localhost ([127.0.0.1]:47063 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i9AH2-0000CK-0B
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2019 11:47:44 -0400
Received: from eggs.gnu.org ([209.51.188.92]:47462)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1i9AGz-0000C7-CE
 for 36566 <at> debbugs.gnu.org; Sat, 14 Sep 2019 11:47:42 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:53448)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1i9AGt-00039s-A4; Sat, 14 Sep 2019 11:47:35 -0400
Received: from [176.228.60.248] (port=2638 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1i9AGs-0006QN-Mb; Sat, 14 Sep 2019 11:47:35 -0400
Date: Sat, 14 Sep 2019 18:47:51 +0300
Message-Id: <83y2yqyj4o.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mauro Aranda <maurooaranda@HIDDEN>
In-reply-to: <CABczVwdfiSF3DpZ0QprBYH_o14PDpDT6nvip__g8K_F1Eyn+AA@HIDDEN>
 (message from Mauro Aranda on Sat, 14 Sep 2019 11:16:04 -0300)
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
References: <87r26yvb4r.fsf@HIDDEN> <871ryy2l1t.fsf@HIDDEN>
 <87r26xjyon.fsf@HIDDEN> <877e8llbzo.fsf@HIDDEN>
 <8736ilaepu.fsf@HIDDEN>
 <87h871u24i.fsf@HIDDEN> <874l2vcrtn.fsf@HIDDEN>
 <874l2eosa7.fsf@HIDDEN>
 <87mufh8jj2.fsf@HIDDEN> <87v9tza6gg.fsf@HIDDEN>
 <875zlvj453.fsf@HIDDEN>
 <CABczVwf8KkvA47HXz2tWWhVe2qDMnep1EwTUxXJ=VrGUH3cPqw@HIDDEN>
 <83zhj7x9az.fsf@HIDDEN>
 <CABczVwdfiSF3DpZ0QprBYH_o14PDpDT6nvip__g8K_F1Eyn+AA@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 36566
Cc: michael_heerdegen@HIDDEN, gazally@HIDDEN, 36566 <at> debbugs.gnu.org,
 npostavs@HIDDEN, monnier@HIDDEN
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: Mauro Aranda <maurooaranda@HIDDEN>
> Date: Sat, 14 Sep 2019 11:16:04 -0300
> Cc: Gemini Lasswell <gazally@HIDDEN>, Michael Heerdegen <michael_heerdegen@HIDDEN>, 36566 <at> debbugs.gnu.org, 
> 	Noam Postavsky <npostavs@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
> 
> >>   CC       print.o
> >> print.c: In function ‘print_preprocess’:
> >> print.c:1155:4: error: invalid operands to binary || (have ‘int’ and ‘Lisp_Object {aka struct Lisp_Object}’)
> >>     || Vprint_continuous_numbering))     \
> >>     ^
> >
> > Thanks.  Please try again, I think I fixed this.
> 
> Builds succesfully now.  Thank you.

Great, thanks for testing.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 14 Sep 2019 14:16:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 10:16:25 2019
Received: from localhost ([127.0.0.1]:47017 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i98qe-0001Th-NY
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2019 10:16:24 -0400
Received: from mail-lf1-f43.google.com ([209.85.167.43]:44933)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maurooaranda@HIDDEN>) id 1i98qd-0001OX-KT
 for 36566 <at> debbugs.gnu.org; Sat, 14 Sep 2019 10:16:24 -0400
Received: by mail-lf1-f43.google.com with SMTP id q11so9251634lfc.11
 for <36566 <at> debbugs.gnu.org>; Sat, 14 Sep 2019 07:16:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=GMP9y5vMUrudSf6G6454MYxCKYhX96hESm3z70wsmTc=;
 b=oxFUBZABWw37wWuUjZC2B+OigIac9UQDEkztr8dyGrMlIq6ebEbdtaeE4jpFxEviug
 yXWRfHteu8v24zDXt8DaLrNnJHdR3zW2TqmuZ8/d6O9I/PnexRKS3uthC0Bu2gkJescu
 NI8VdKx4WaZklfR54QINcA7KRB9D/FFlWpxQ4mg5tQuFRfjDNlGd+EuopNmIURU85bPJ
 kLzZObUvqJxKYkCumiqLfhUXNa/cYNJRdCnZZe6/8uiCmkZEMbJbs4Gf/SXAG4NCZ/iq
 BAm1dXAtIVHoeZpjEk7DTU1nrKtYvBLKJ7ygQuH/sdURdCcEXZDuhATy938/Tu9xB8Y7
 PbVg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=GMP9y5vMUrudSf6G6454MYxCKYhX96hESm3z70wsmTc=;
 b=PE+6jtzZwY/M1c1ocLHeIS2VYvtTCFTQRGOzifzU02yRPRNzNo9d5H4gH2N6plJenB
 mclWulkMn44FZzR3cQYtRb1B8+ksoYxJhaMPWGCdk8HGasH5DQiaEEG3WpuuUY0N8yIU
 wKnqPA3Nc2bapMCpywMWV6+ax+/cT90JKhJggsac91rThZ/8WAU7LVp1gLZMzfxbn6Tc
 FuC9dycMuI+M0T3uW+bn+75trdLhu570Zqr11p/j18aYyyw6bczif23wE95tjk2cdjlC
 HQle/Yk446NjdNh53rm4BYt07yd/V/1hcEwowf22436uQY8l3ZvyYhwxb0BUPr9kzWKK
 pnLA==
X-Gm-Message-State: APjAAAX+F3tzXsOE6pN91IhAuJPF8wztGFtX5q8EYTrq7/EKbE4JxXpn
 Zl3Hs2GzNC2paKn4uAMOwH8y4PqZ5Wr8kRjKQeo=
X-Google-Smtp-Source: APXvYqyBq/kto58NoLtZqWsnablBkzJeyqOXQOul7K2skeoYdO9bzf2LYLvwfqrkJgeXQr1DuOS1f3Zk2VlR9yuY+Js=
X-Received: by 2002:a19:f711:: with SMTP id z17mr14809023lfe.58.1568470577715; 
 Sat, 14 Sep 2019 07:16:17 -0700 (PDT)
MIME-Version: 1.0
References: <87r26yvb4r.fsf@HIDDEN> <871ryy2l1t.fsf@HIDDEN>
 <87r26xjyon.fsf@HIDDEN> <877e8llbzo.fsf@HIDDEN>
 <8736ilaepu.fsf@HIDDEN>
 <87h871u24i.fsf@HIDDEN> <874l2vcrtn.fsf@HIDDEN>
 <874l2eosa7.fsf@HIDDEN>
 <87mufh8jj2.fsf@HIDDEN> <87v9tza6gg.fsf@HIDDEN>
 <875zlvj453.fsf@HIDDEN>
 <CABczVwf8KkvA47HXz2tWWhVe2qDMnep1EwTUxXJ=VrGUH3cPqw@HIDDEN>
 <83zhj7x9az.fsf@HIDDEN>
In-Reply-To: <83zhj7x9az.fsf@HIDDEN>
From: Mauro Aranda <maurooaranda@HIDDEN>
Date: Sat, 14 Sep 2019 11:16:04 -0300
Message-ID: <CABczVwdfiSF3DpZ0QprBYH_o14PDpDT6nvip__g8K_F1Eyn+AA@HIDDEN>
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000a01e1c05928403d0"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36566
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>,
 Gemini Lasswell <gazally@HIDDEN>, 36566 <at> debbugs.gnu.org,
 Noam Postavsky <npostavs@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
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 (-)

--000000000000a01e1c05928403d0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Mauro Aranda <maurooaranda@HIDDEN>
>> Date: Sat, 14 Sep 2019 10:44:23 -0300
>> Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 36566 <at> debbugs.gnu.org,
>>  Noam Postavsky <npostavs@HIDDEN>, Stefan Monnier <
monnier@HIDDEN>
>>
>> After commit 6eaf39d21b70802e6bc607ee2fc2fff67b79231a
>> Fix unnecessary hash table creation in cl-prin1 (bug#36566)
>>
>> I can't build emacs with configure option
>> --enable-check-lisp-object-type.
>>
>> This is the compilation error I get:
>>   CC       print.o
>> print.c: In function =E2=80=98print_preprocess=E2=80=99:
>> print.c:1155:4: error: invalid operands to binary || (have =E2=80=98int=
=E2=80=99 and
=E2=80=98Lisp_Object {aka struct Lisp_Object}=E2=80=99)
>>     || Vprint_continuous_numbering))     \
>>     ^
>
> Thanks.  Please try again, I think I fixed this.

Builds succesfully now.  Thank you.

--000000000000a01e1c05928403d0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Eli Zaretskii &lt;<a href=3D"mailto:eliz@HIDDEN">eliz@gnu=
.org</a>&gt; writes:<br><br>&gt;&gt; From: Mauro Aranda &lt;<a href=3D"mail=
to:maurooaranda@HIDDEN">maurooaranda@HIDDEN</a>&gt;<br>&gt;&gt; Date:=
 Sat, 14 Sep 2019 10:44:23 -0300<br>&gt;&gt; Cc: Michael Heerdegen &lt;<a h=
ref=3D"mailto:michael_heerdegen@HIDDEN">michael_heerdegen@HIDDEN</a>&gt;, <=
a href=3D"mailto:36566 <at> debbugs.gnu.org">36566 <at> debbugs.gnu.org</a>,<br>&gt;&=
gt; =C2=A0Noam Postavsky &lt;<a href=3D"mailto:npostavs@HIDDEN">npostavs=
@gmail.com</a>&gt;, Stefan Monnier &lt;<a href=3D"mailto:monnier@HIDDEN=
eal.ca">monnier@HIDDEN</a>&gt;<br>&gt;&gt; <br>&gt;&gt; After com=
mit 6eaf39d21b70802e6bc607ee2fc2fff67b79231a<br>&gt;&gt; Fix unnecessary ha=
sh table creation in cl-prin1 (bug#36566)<br>&gt;&gt; <br>&gt;&gt; I can&#3=
9;t build emacs with configure option<br>&gt;&gt; --enable-check-lisp-objec=
t-type.<br>&gt;&gt; <br>&gt;&gt; This is the compilation error I get:<br>&g=
t;&gt; =C2=A0 CC =C2=A0 =C2=A0 =C2=A0 print.o<br>&gt;&gt; print.c: In funct=
ion =E2=80=98print_preprocess=E2=80=99:<br>&gt;&gt; print.c:1155:4: error: =
invalid operands to binary || (have =E2=80=98int=E2=80=99 and =E2=80=98Lisp=
_Object {aka struct Lisp_Object}=E2=80=99)<br>&gt;&gt; =C2=A0 =C2=A0 || Vpr=
int_continuous_numbering)) =C2=A0 =C2=A0 \<br>&gt;&gt; =C2=A0 =C2=A0 ^<br>&=
gt;<br>&gt; Thanks.=C2=A0 Please try again, I think I fixed this.<br><br>Bu=
ilds succesfully now.=C2=A0 Thank you.</div>

--000000000000a01e1c05928403d0--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 14 Sep 2019 14:05:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 10:05:17 2019
Received: from localhost ([127.0.0.1]:46991 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i98ft-0008NY-GQ
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2019 10:05:17 -0400
Received: from eggs.gnu.org ([209.51.188.92]:33272)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1i98fr-0008NI-PS
 for 36566 <at> debbugs.gnu.org; Sat, 14 Sep 2019 10:05:16 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:52675)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1i98fm-0003NN-2x; Sat, 14 Sep 2019 10:05:10 -0400
Received: from [176.228.60.248] (port=4329 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1i98fk-000732-Vb; Sat, 14 Sep 2019 10:05:09 -0400
Date: Sat, 14 Sep 2019 17:05:24 +0300
Message-Id: <83zhj7x9az.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Mauro Aranda <maurooaranda@HIDDEN>
In-reply-to: <CABczVwf8KkvA47HXz2tWWhVe2qDMnep1EwTUxXJ=VrGUH3cPqw@HIDDEN>
 (message from Mauro Aranda on Sat, 14 Sep 2019 10:44:23 -0300)
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
References: <87r26yvb4r.fsf@HIDDEN> <871ryy2l1t.fsf@HIDDEN>
 <87r26xjyon.fsf@HIDDEN> <877e8llbzo.fsf@HIDDEN>
 <8736ilaepu.fsf@HIDDEN>
 <87h871u24i.fsf@HIDDEN> <874l2vcrtn.fsf@HIDDEN>
 <874l2eosa7.fsf@HIDDEN>
 <87mufh8jj2.fsf@HIDDEN> <87v9tza6gg.fsf@HIDDEN>
 <875zlvj453.fsf@HIDDEN>
 <CABczVwf8KkvA47HXz2tWWhVe2qDMnep1EwTUxXJ=VrGUH3cPqw@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 36566
Cc: michael_heerdegen@HIDDEN, gazally@HIDDEN, 36566 <at> debbugs.gnu.org,
 npostavs@HIDDEN, monnier@HIDDEN
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: Mauro Aranda <maurooaranda@HIDDEN>
> Date: Sat, 14 Sep 2019 10:44:23 -0300
> Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 36566 <at> debbugs.gnu.org,
>  Noam Postavsky <npostavs@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
> 
> After commit 6eaf39d21b70802e6bc607ee2fc2fff67b79231a
> Fix unnecessary hash table creation in cl-prin1 (bug#36566)
> 
> I can't build emacs with configure option
> --enable-check-lisp-object-type.
> 
> This is the compilation error I get:
>   CC       print.o
> print.c: In function ‘print_preprocess’:
> print.c:1155:4: error: invalid operands to binary || (have ‘int’ and ‘Lisp_Object {aka struct Lisp_Object}’)
>     || Vprint_continuous_numbering))     \
>     ^

Thanks.  Please try again, I think I fixed this.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 14 Sep 2019 13:44:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 09:44:47 2019
Received: from localhost ([127.0.0.1]:46028 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i98M1-0007cY-Mr
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2019 09:44:47 -0400
Received: from mail-lj1-f196.google.com ([209.85.208.196]:39045)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maurooaranda@HIDDEN>) id 1i98Ly-0007cK-N7
 for 36566 <at> debbugs.gnu.org; Sat, 14 Sep 2019 09:44:43 -0400
Received: by mail-lj1-f196.google.com with SMTP id j16so29693840ljg.6
 for <36566 <at> debbugs.gnu.org>; Sat, 14 Sep 2019 06:44:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=caie8DLYknpIAPaTeRb1YKidC0bnDX92xLl61RWO8No=;
 b=Me64ZwaN1BZGU3mzpTyrpQK0oPJtlsnihmX1Hpd/YNgSkzUi6WQJdS6A/e6PlEfus2
 kohul3bFgw+BdmbP/fk+igbmOUxoaJxSG5UYtWlZedZ81el9IFmSV+1dE/TEcRaaov9n
 4ylQKQHmsjtR/btmcz8wc0eocZ2v0/lOi1lrVRIDWCl/Pm8DK+8meutC8MI5dj4LDEsO
 MU0ETlHCjKv1zrSKgI3blQ9Ao/6h1malppDeRuTYaRSGDWGlKsTBdTHBSS7ACidjuqpA
 mTejXh5frYFznOPx211VmW0hgC16kgX2RGvBoeLtcvJdKj8c/WLLb8OP9/pqKb3qMTR6
 SdxQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=caie8DLYknpIAPaTeRb1YKidC0bnDX92xLl61RWO8No=;
 b=JJdpSyAP6yikBm7UOcoo/t6V2Jbyh4vekmcakq4a02+En1voQYGfrIfe9c/udsI1Sy
 AvSjKqeZ/T990eA7ShFUqt+sn8R6Oxqo6nQJjZgkgQIQAVvNNddl5x7Lxx7ixmEdtX+z
 lCUC7LAJ94aT5duo4WXKJ23OlqN3L9oZAimuXHCVpeapRK4JqFlHRNHDn35WEvPuONjZ
 A2rGgvFcjORs85pwDeqaM0Vnz4X/2TatsqoTL17jSD667p58HypSOqmJdnUGpSHutC9H
 1j0YBF9hshndkCX/S+GKG5QLXxmaF4fw4LiZOe0oETl/DIM8zXDgCuTNRkkmSgjNvbBA
 7huQ==
X-Gm-Message-State: APjAAAWSage3K2LsRlyGydQSTaVPauf0lTX0KGYYTqOnMWNuMnJAJY1b
 dZGgBLK35CWKRrUdPw5JSAmxtT8GwQUhJsRjoyA=
X-Google-Smtp-Source: APXvYqwqTuOt/puJGyTR2p3kQ49UuVTURAjtgxvm4507luWgeMvJGqUHwY2WPWGQeLnP8Xk3Bxka4zp9Jh/TCAIcAYE=
X-Received: by 2002:a2e:7801:: with SMTP id t1mr18675089ljc.140.1568468676572; 
 Sat, 14 Sep 2019 06:44:36 -0700 (PDT)
MIME-Version: 1.0
References: <87r26yvb4r.fsf@HIDDEN> <871ryy2l1t.fsf@HIDDEN>
 <87r26xjyon.fsf@HIDDEN> <877e8llbzo.fsf@HIDDEN>
 <8736ilaepu.fsf@HIDDEN>
 <87h871u24i.fsf@HIDDEN> <874l2vcrtn.fsf@HIDDEN>
 <874l2eosa7.fsf@HIDDEN>
 <87mufh8jj2.fsf@HIDDEN> <87v9tza6gg.fsf@HIDDEN>
 <875zlvj453.fsf@HIDDEN>
In-Reply-To: <875zlvj453.fsf@HIDDEN>
From: Mauro Aranda <maurooaranda@HIDDEN>
Date: Sat, 14 Sep 2019 10:44:23 -0300
Message-ID: <CABczVwf8KkvA47HXz2tWWhVe2qDMnep1EwTUxXJ=VrGUH3cPqw@HIDDEN>
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
To: Gemini Lasswell <gazally@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000004efad805928392b2"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36566
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 36566 <at> debbugs.gnu.org,
 Noam Postavsky <npostavs@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
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 (-)

--0000000000004efad805928392b2
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

After commit 6eaf39d21b70802e6bc607ee2fc2fff67b79231a
Fix unnecessary hash table creation in cl-prin1 (bug#36566)

I can't build emacs with configure option
--enable-check-lisp-object-type.

This is the compilation error I get:
  CC       print.o
print.c: In function =E2=80=98print_preprocess=E2=80=99:
print.c:1155:4: error: invalid operands to binary || (have =E2=80=98int=E2=
=80=99 and
=E2=80=98Lisp_Object {aka struct Lisp_Object}=E2=80=99)
    || Vprint_continuous_numbering))     \
    ^
print.c:1188:7: note: in expansion of macro =E2=80=98PRINT_CIRCLE_CANDIDATE=
_P=E2=80=99
   if (PRINT_CIRCLE_CANDIDATE_P (obj))
       ^
print.c: In function =E2=80=98print_object=E2=80=99:
print.c:1155:4: error: invalid operands to binary || (have =E2=80=98int=E2=
=80=99 and
=E2=80=98Lisp_Object {aka struct Lisp_Object}=E2=80=99)
    || Vprint_continuous_numbering))     \
    ^
print.c:1866:12: note: in expansion of macro =E2=80=98PRINT_CIRCLE_CANDIDAT=
E_P=E2=80=99
   else if (PRINT_CIRCLE_CANDIDATE_P (obj))
            ^
Makefile:402: recipe for target 'print.o' failed
make[1]: *** [print.o] Error 1
make[1]: Leaving directory '/home/tbb/emacs/emacs/src'
Makefile:424: recipe for target 'src' failed
make: *** [src] Error 2

However, using plain ./configure && make
builds succesfully.

Previous commit builds, using the same option.
I add system information, as output by `report-emacs-bug':

In GNU Emacs 27.0.50 (build 4, i686-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2019-09-14 built on the-blackbeard
Repository revision: 5c40c21a47062782bc983f41e8eeb97180dca693
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Ubuntu 16.04.6 LTS

Configured using:
 'configure --enable-check-lisp-object-type'

--0000000000004efad805928392b2
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">After commit 6eaf39d21b70802e6bc607ee2fc2fff67b79231a<br>F=
ix unnecessary hash table creation in cl-prin1 (bug#36566)<br><br>I can&#39=
;t build emacs with configure option<br>--enable-check-lisp-object-type.<br=
><br>This is the compilation error I get:<br>=C2=A0 CC =C2=A0 =C2=A0 =C2=A0=
 print.o<br>print.c: In function =E2=80=98print_preprocess=E2=80=99:<br>pri=
nt.c:1155:4: error: invalid operands to binary || (have =E2=80=98int=E2=80=
=99 and =E2=80=98Lisp_Object {aka struct Lisp_Object}=E2=80=99)<br>=C2=A0 =
=C2=A0 || Vprint_continuous_numbering)) =C2=A0 =C2=A0 \<br>=C2=A0 =C2=A0 ^<=
br>print.c:1188:7: note: in expansion of macro =E2=80=98PRINT_CIRCLE_CANDID=
ATE_P=E2=80=99<br>=C2=A0 =C2=A0if (PRINT_CIRCLE_CANDIDATE_P (obj))<br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0^<br>print.c: In function =E2=80=98print_object=E2=
=80=99:<br>print.c:1155:4: error: invalid operands to binary || (have =E2=
=80=98int=E2=80=99 and =E2=80=98Lisp_Object {aka struct Lisp_Object}=E2=80=
=99)<br>=C2=A0 =C2=A0 || Vprint_continuous_numbering)) =C2=A0 =C2=A0 \<br>=
=C2=A0 =C2=A0 ^<br>print.c:1866:12: note: in expansion of macro =E2=80=98PR=
INT_CIRCLE_CANDIDATE_P=E2=80=99<br>=C2=A0 =C2=A0else if (PRINT_CIRCLE_CANDI=
DATE_P (obj))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^<br>Makefile:40=
2: recipe for target &#39;print.o&#39; failed<br>make[1]: *** [print.o] Err=
or 1<br>make[1]: Leaving directory &#39;/home/tbb/emacs/emacs/src&#39;<br>M=
akefile:424: recipe for target &#39;src&#39; failed<br>make: *** [src] Erro=
r 2<br><br><div>However, using plain ./configure &amp;&amp; make</div><div>=
builds succesfully.</div><div><br></div><div>Previous commit builds, using =
the same option.</div><div>I add system information, as output by `report-e=
macs-bug&#39;:</div><br>In GNU Emacs 27.0.50 (build 4, i686-pc-linux-gnu, G=
TK+ Version 3.18.9)<br>=C2=A0of 2019-09-14 built on the-blackbeard<br>Repos=
itory revision: 5c40c21a47062782bc983f41e8eeb97180dca693<br>Repository bran=
ch: HEAD<br>Windowing system distributor &#39;The X.Org Foundation&#39;, ve=
rsion 11.0.11906000<br>System Description: Ubuntu 16.04.6 LTS<br><br>Config=
ured using:<br>=C2=A0&#39;configure --enable-check-lisp-object-type&#39;<br=
></div>

--0000000000004efad805928392b2--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 13 Sep 2019 21:09:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 13 17:09:11 2019
Received: from localhost ([127.0.0.1]:45671 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i8soZ-0006Z0-Fk
	for submit <at> debbugs.gnu.org; Fri, 13 Sep 2019 17:09:11 -0400
Received: from aibo.runbox.com ([91.220.196.211]:58376)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gazally@HIDDEN>) id 1i8soX-0006Yr-SL
 for 36566 <at> debbugs.gnu.org; Fri, 13 Sep 2019 17:09:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; 
 s=rbselector1;
 h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From;
 bh=E8Vv7jnNihGc1qf7bvoS9hqulc6Eu6scm6AMtQb47IQ=; b=BtknmvaxwkioSGGghFwCWFLtob
 6O8HlZurTRGaI4AxuvBEupGTkRZ0cVhWDmv3nicUBvpQAfXkIJeX3fn5M2DoVNMf2mUIBmGI6vT64
 U7JjsfGP3YoVIayNSNbeH1X9bLRmXY7vAHiin0htvG0GD2vIZ0mCYvXqjW3ZfMw8a81yeCeq08+7+
 sy1W42SXVRxsnoC3mO2aCLVjO9qAHVmPHP8rXmsadREV/m5nIeveUfD2Mz9qrIW0HmpPqHQyikEmo
 y7JLtyc7JoO+ACNDZGt7SjO5326i0XfcNYX2UXEFwRZk2U/qOs85gzm6Fs7SGNEsCtk3Xy5nH8Ysw
 BQQ1D63Q==;
Received: from [10.9.9.203] (helo=mailfront21.runbox)
 by mailtransmit03.runbox with esmtp (Exim 4.86_2)
 (envelope-from <gazally@HIDDEN>)
 id 1i8soU-0005pg-Ls; Fri, 13 Sep 2019 23:09:06 +0200
Received: by mailfront21.runbox with esmtpsa [Authenticated alias (696087)]
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1)
 id 1i8so0-0000Uq-4S; Fri, 13 Sep 2019 23:08:36 +0200
From: Gemini Lasswell <gazally@HIDDEN>
To: Noam Postavsky <npostavs@HIDDEN>
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
References: <87r26yvb4r.fsf@HIDDEN> <871ryy2l1t.fsf@HIDDEN>
 <87r26xjyon.fsf@HIDDEN> <877e8llbzo.fsf@HIDDEN>
 <8736ilaepu.fsf@HIDDEN> <87h871u24i.fsf@HIDDEN>
 <874l2vcrtn.fsf@HIDDEN> <874l2eosa7.fsf@HIDDEN>
 <87mufh8jj2.fsf@HIDDEN> <87v9tza6gg.fsf@HIDDEN>
Date: Fri, 13 Sep 2019 14:08:24 -0700
In-Reply-To: <87v9tza6gg.fsf@HIDDEN> (Noam Postavsky's message of "Tue, 10
 Sep 2019 22:54:07 -0400")
Message-ID: <875zlvj453.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 36566
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 36566 <at> debbugs.gnu.org,
 Stefan Monnier <monnier@HIDDEN>
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.7 (-)

Noam Postavsky <npostavs@HIDDEN> writes:

>
> Okay, there's nothing more from my side, so I guess you can go ahead and
> push when ready.

Pushed.  I'll leave this bug open for the remaining performance problem
in Edebug.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 11 Sep 2019 02:54:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 10 22:54:17 2019
Received: from localhost ([127.0.0.1]:41915 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i7sls-0004WN-1b
	for submit <at> debbugs.gnu.org; Tue, 10 Sep 2019 22:54:17 -0400
Received: from mail-io1-f65.google.com ([209.85.166.65]:46357)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1i7slq-0004WB-LG
 for 36566 <at> debbugs.gnu.org; Tue, 10 Sep 2019 22:54:15 -0400
Received: by mail-io1-f65.google.com with SMTP id d17so20523618ios.13
 for <36566 <at> debbugs.gnu.org>; Tue, 10 Sep 2019 19:54:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=3KOljMmLaoCu6IV9/10Ut6p7xdmaO5UrNmoFYucQPeg=;
 b=hQHeoRICI8dC/SKoGiwtblPlzvpUZiw2l0FAG6yeIkpccxlozN48Jl+23t+6jK2bkT
 VRqtfous6bwCEB8m9C1MAO1vbgDpUz2z02Il56jUQfbcJ3bLopwsS1YAX40Lnq/HK2Fk
 cL0XSyBgcyXMzJbVRNMYDh3LEChruGwAYxa/HnacYalc03c6vPVRYzdjiKQTNZ+z9vaS
 sBXOuuopk4gTOSg6RiCPNKZZr47xabNVCo7ycl77SzbKb+SsDOF78zxI4epwgHPtuk5A
 zqUfVoFKSEW1OnTGSS1h7a3QYVDglNXBrTHCgnr/XA2016Y4DFdHg7N+MC3BAbr6BnUp
 9Z0Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=3KOljMmLaoCu6IV9/10Ut6p7xdmaO5UrNmoFYucQPeg=;
 b=B7/j3IHMsLWJlz3/cv0ekzaPgtD/XMBIB+fQbjYiGjLIQ06Q+pSIo1K68NH8RJSEda
 VFauQDtYuEEtH5tXoOp5GlsG1kEMEW01TIDszRNbPGUTP4P6iIvml0dvsDuUWiUJ6tpw
 V8aXZMDaBa9+OHsf1gUsVkAWYxEmqDdLkCIBjhyqB9cfGAROQ0fkmgnh6puIijetdzx1
 OtPhMX0KF8Qw58cjQoWQTvKinyXezWbQVpi6pq9Hv1pCZfI5m1M5enfWRBhRL8ZSskaD
 mpMt47QaHkmCNgKQK51PMe47vMA5of9Mz0UZlceBUbLG1BUYK3xQtFIjmm3ijTswoBLj
 CyQw==
X-Gm-Message-State: APjAAAViJea2ar4MyGQqb0Y8gTMS5s/o5mXaKfLTSQL/KnBHh8t/snVw
 YLiAWsCDy67fwe8TNc2I/kg=
X-Google-Smtp-Source: APXvYqwdVHfslefqv+92f7pIXPqX9uDK9Z0zEeMcdd6SgrVCu/cdnKkrFBq/7US8YwsBCgt1uvTZ1g==
X-Received: by 2002:a02:3b6f:: with SMTP id i47mr10133716jaf.24.1568170448897; 
 Tue, 10 Sep 2019 19:54:08 -0700 (PDT)
Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.gmail.com with ESMTPSA id
 e19sm12857002iom.57.2019.09.10.19.54.07
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Tue, 10 Sep 2019 19:54:08 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: Gemini Lasswell <gazally@HIDDEN>
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
References: <87r26yvb4r.fsf@HIDDEN> <871ryy2l1t.fsf@HIDDEN>
 <87r26xjyon.fsf@HIDDEN> <877e8llbzo.fsf@HIDDEN>
 <8736ilaepu.fsf@HIDDEN> <87h871u24i.fsf@HIDDEN>
 <874l2vcrtn.fsf@HIDDEN> <874l2eosa7.fsf@HIDDEN>
 <87mufh8jj2.fsf@HIDDEN>
Date: Tue, 10 Sep 2019 22:54:07 -0400
In-Reply-To: <87mufh8jj2.fsf@HIDDEN> (Gemini Lasswell's message of "Fri,
 06 Sep 2019 09:41:05 -0700")
Message-ID: <87v9tza6gg.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36566
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 36566 <at> debbugs.gnu.org,
 Stefan Monnier <monnier@HIDDEN>
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 (-)

Gemini Lasswell <gazally@HIDDEN> writes:

> Noam Postavsky <npostavs@HIDDEN> writes:
>
>>> Subject: [PATCH 2/5] Improve performance of backtrace printing (bug#36566)
>>>
>>> * lisp/emacs-lisp/cl-print.el (cl-print-to-string-with-limit): Reduce
>>> print-level and print-length more quickly when the structure being
>>> printed is very large.
>>
>> Is this one still needed?  I tried reverting it, and it seems to make no
>> noticeable difference now (I didn't really measure though, I can't think
>> of a straightforward way of doing that), at least for the case that
>> Michael posted.
>
> My straightforward way of doing that is
>
> M-: (benchmark-run (revert-buffer))  RET
>
> while the backtrace buffer is current.

I actually get 0.9 vs 1.3 seconds (the latter being with patch 2/5
reverted) with Michael's example, which is more of a difference than I
expected based on my non-timed trials.

> I tried, with and without the patch, these steps:
>
> Navigate to org-export--prune-tree in ox.el.
> C-M-x to instrument it with Edebug.
> Open a 150K org-mode file.
> C-c C-e h H
> Edebug to line 2728 of ox.el (inside the lambda bound to 'walk-data').
> Use 'd' to get a backtrace. 
> M-: (benchmark-run (revert-buffer)) RET
>
> With the patch: (0.594630583 9 0.31395808699999783)
> Without the patch: (0.925387816 15 0.5158638049999986)
>
> I would expect that debugging deeper into org-mode export (so that there
> are more frames to display containing the org parse tree) with a larger
> org-mode file would exaggerate the difference.

Alright, it's probably enough to justify this.

> Edebug is very sluggish debugging org-export--prune-tree because it is
> sending some 400K lines to the echo area, and then those make *Messages*
> redisplay slow.  I will work on another patch to improve Edebug's
> behavior in this case.
>
>>> Subject: [PATCH 4/5] Create common tests for print.c and cl-print.el
>>
>> Extra colon.
>>
>>> Subject: [PATCH 5/5] Don't build print-number-table unless it will be used
>>
>> We try not to use hashes to reference commits
>>
>
> I'll fix the patch comments as you suggest.

Okay, there's nothing more from my side, so I guess you can go ahead and
push when ready.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 6 Sep 2019 16:41:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 06 12:41:37 2019
Received: from localhost ([127.0.0.1]:37294 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i6HIn-0005KS-2w
	for submit <at> debbugs.gnu.org; Fri, 06 Sep 2019 12:41:37 -0400
Received: from aibo.runbox.com ([91.220.196.211]:41370)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gazally@HIDDEN>) id 1i6HIk-0005KF-Fe
 for 36566 <at> debbugs.gnu.org; Fri, 06 Sep 2019 12:41:35 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; 
 s=rbselector1;
 h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From;
 bh=zerPfCtyJH+cBNd5Q5r7Tm4pJZAC8DWTrKqQA+If9Ps=; b=oGMgo14N4zyxRoU2goVOB/5BXS
 QwoSWrYRF8zUpOu0lfR8BYuFzrhRB9s/f9zQJfNd8w8GBGeOI0c4mt/pueTWTJB3LLd4qS8yKgSj5
 RXWfOuQFbW6IUrfvw5bcPMm+DdfjxScZP6BXOnmyoYBsND3s8Pwbp2BcWWDdRhCn29bhWPaAU8KIF
 EMvg5ilo0YNdIhcEeMZW9tHTVUGThHMwnRyKGOm98q+ISOAOmAb04sUHdyS3xErUASATWv3HV75qK
 6eIJdYfBmWdebzhrPvBiQRb7P9cNRJSUxhZ8qXcjZsNueaFufRa+m8WG128ReckRni6bO41x9ez9X
 NKXNavYQ==;
Received: from [10.9.9.202] (helo=mailfront20.runbox)
 by mailtransmit03.runbox with esmtp (Exim 4.86_2)
 (envelope-from <gazally@HIDDEN>)
 id 1i6HIh-0006h5-2c; Fri, 06 Sep 2019 18:41:31 +0200
Received: by mailfront20.runbox with esmtpsa [Authenticated alias (696087)]
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1)
 id 1i6HIT-0007LS-Gp; Fri, 06 Sep 2019 18:41:18 +0200
From: Gemini Lasswell <gazally@HIDDEN>
To: Noam Postavsky <npostavs@HIDDEN>
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
References: <87r26yvb4r.fsf@HIDDEN> <871ryy2l1t.fsf@HIDDEN>
 <87r26xjyon.fsf@HIDDEN> <877e8llbzo.fsf@HIDDEN>
 <8736ilaepu.fsf@HIDDEN> <87h871u24i.fsf@HIDDEN>
 <874l2vcrtn.fsf@HIDDEN> <874l2eosa7.fsf@HIDDEN>
Date: Fri, 06 Sep 2019 09:41:05 -0700
In-Reply-To: <874l2eosa7.fsf@HIDDEN> (Noam Postavsky's message of "Sun, 18
 Aug 2019 21:30:56 -0400")
Message-ID: <87mufh8jj2.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 36566
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 36566 <at> debbugs.gnu.org,
 Stefan Monnier <monnier@HIDDEN>
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.7 (-)

Noam Postavsky <npostavs@HIDDEN> writes:

>> Subject: [PATCH 2/5] Improve performance of backtrace printing (bug#36566)
>>
>> * lisp/emacs-lisp/cl-print.el (cl-print-to-string-with-limit): Reduce
>> print-level and print-length more quickly when the structure being
>> printed is very large.
>
> Is this one still needed?  I tried reverting it, and it seems to make no
> noticeable difference now (I didn't really measure though, I can't think
> of a straightforward way of doing that), at least for the case that
> Michael posted.

My straightforward way of doing that is

M-: (benchmark-run (revert-buffer))  RET

while the backtrace buffer is current.

I tried, with and without the patch, these steps:

Navigate to org-export--prune-tree in ox.el.
C-M-x to instrument it with Edebug.
Open a 150K org-mode file.
C-c C-e h H
Edebug to line 2728 of ox.el (inside the lambda bound to 'walk-data').
Use 'd' to get a backtrace. 
M-: (benchmark-run (revert-buffer)) RET

With the patch: (0.594630583 9 0.31395808699999783)
Without the patch: (0.925387816 15 0.5158638049999986)

I would expect that debugging deeper into org-mode export (so that there
are more frames to display containing the org parse tree) with a larger
org-mode file would exaggerate the difference.

Edebug is very sluggish debugging org-export--prune-tree because it is
sending some 400K lines to the echo area, and then those make *Messages*
redisplay slow.  I will work on another patch to improve Edebug's
behavior in this case.

>> Subject: [PATCH 4/5] Create common tests for print.c and cl-print.el
>
> Extra colon.
>
>> Subject: [PATCH 5/5] Don't build print-number-table unless it will be used
>
> We try not to use hashes to reference commits
>

I'll fix the patch comments as you suggest.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 19 Aug 2019 01:31:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 18 21:31:06 2019
Received: from localhost ([127.0.0.1]:58983 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hzWVm-0001it-Hx
	for submit <at> debbugs.gnu.org; Sun, 18 Aug 2019 21:31:06 -0400
Received: from mail-io1-f45.google.com ([209.85.166.45]:45888)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1hzWVk-0001iO-BT
 for 36566 <at> debbugs.gnu.org; Sun, 18 Aug 2019 21:31:04 -0400
Received: by mail-io1-f45.google.com with SMTP id t3so495191ioj.12
 for <36566 <at> debbugs.gnu.org>; Sun, 18 Aug 2019 18:31:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=7t6/xN5PCQyjvO7Caq+DpxWRGBToNTTvjd0UDTXaaro=;
 b=Dzb1tWPHydl1At0Drv6XjWmH37waVQHjs02thV16aYzlyDTl25JQsbeWexoRM/MA/1
 sF2q5fDIk8bH0yMpwLFRn8TQih/09ON1UFMz7o4dcVjXy+YYkPgjHw5/SfFk24l2di20
 BxcxvXq0nBJqx5LQE+6wRYRP/VKsE1tUD8ekcKkji8IHHG8euOJu5fE37/0OcW3nWUYk
 qkRma2t4EOUke8M2r4kPfhYt/p+S1QZBuitBf2/Jejmrl9YHx5O+GznuJucg3GdYHML5
 GxxwVR6dsm/G7VysKdHlZJ3MNu6rLJfFmezDEkjy2RlQD9Grm+nzfsFARfef/DMj79Qx
 Ok/Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=7t6/xN5PCQyjvO7Caq+DpxWRGBToNTTvjd0UDTXaaro=;
 b=NVCm9/vktNJfSoZ3qikgeuNqbIbvelPX4tO2sxve61G9CUv6vibYk5eALBTJ6Mfhom
 tegXYPd7trZ8B4WnUBUWU0NhneoVaho8pqA/oYnM10drDy6lzIZ7MF5dfjg4l09tHwOH
 QSDlvcUmxSGz7GPw6eqt9NmN128RhfYuHYgh7FytYTN0fWz6FzDvTyO2t7HX1B4lGF/a
 VMr0XJWOlEsGJmQUuaytGaDY5dBVwveaO694JYLbbbwmZggX4A/UAiEwkAg79gVdHTUL
 PeWbnf5TNwhPlrt1USZueXuubWuEp7BFIkaFLtDBikd//bDnKT/OMKubuZDoLyHVSmK8
 gCbQ==
X-Gm-Message-State: APjAAAVTyBpIW/tQO24HYhMwj6HngJ47et+oot8J04UhWB6e/9gVnr8k
 EYqOoTVOoDCXUmUT2Riqhck=
X-Google-Smtp-Source: APXvYqzRlAdYs8P9CI4f/4ETwFAfxFCnar+hvMoeYXmbYoxTEwe0pERYY0pMhShzf6YMbR5yeRqoLw==
X-Received: by 2002:a05:6638:303:: with SMTP id
 w3mr15608169jap.103.1566178258672; 
 Sun, 18 Aug 2019 18:30:58 -0700 (PDT)
Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.gmail.com with ESMTPSA id
 b20sm9588788ios.44.2019.08.18.18.30.57
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sun, 18 Aug 2019 18:30:57 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: Gemini Lasswell <gazally@HIDDEN>
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
References: <87r26yvb4r.fsf@HIDDEN> <871ryy2l1t.fsf@HIDDEN>
 <87r26xjyon.fsf@HIDDEN> <877e8llbzo.fsf@HIDDEN>
 <8736ilaepu.fsf@HIDDEN> <87h871u24i.fsf@HIDDEN>
 <874l2vcrtn.fsf@HIDDEN>
Date: Sun, 18 Aug 2019 21:30:56 -0400
In-Reply-To: <874l2vcrtn.fsf@HIDDEN> (Gemini Lasswell's message of "Mon,
 05 Aug 2019 12:53:08 -0700")
Message-ID: <874l2eosa7.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36566
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 36566 <at> debbugs.gnu.org,
 Stefan Monnier <monnier@HIDDEN>
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 (-)

Gemini Lasswell <gazally@HIDDEN> writes:

>>> ...by modifying the logic in print_preprocess to not create a hash table
>>> if the top-level object is a string with no properties.
>>
>> This last idea sounds like a straightforward win to me, with no obvious
>> drawbacks.  I mean, no point in allocating a hash table if we can
>> cheaply detect it will never be used, right?
>
> I made that change, and then, in studying the uses of
> print-number-table, found more cases in which allocated hash tables were
> never used.  Since 2011 when byte-compile-disable-print-circle was
> marked obsolete and 2012 when commit 4ae29f89be changed the logic in
> print_object, the only time print-number-table gets used is when
> print-circle is non-nil.

> Michael's use case is down to 0.7s on my machine.

> Subject: [PATCH 2/5] Improve performance of backtrace printing (bug#36566)
>
> * lisp/emacs-lisp/cl-print.el (cl-print-to-string-with-limit): Reduce
> print-level and print-length more quickly when the structure being
> printed is very large.

Is this one still needed?  I tried reverting it, and it seems to make no
noticeable difference now (I didn't really measure though, I can't think
of a straightforward way of doing that), at least for the case that
Michael posted.

> Subject: [PATCH 4/5] Create common tests for print.c and cl-print.el
>
> * test/lisp/emacs-lisp/cl-print-tests.el:
                                          ^
Extra colon.

> (cl-print--test, cl-print-tests-1, cl-print-tests-2)
> (cl-print-tests-3, cl-print-tests-4, cl-print-tests-5)
> (cl-print-tests-strings, cl-print-circle, cl-print-circle-2):
> Remove.

> Subject: [PATCH 5/5] Don't build print-number-table unless it will be used
>
> There are only a few users of print-number-table, and none of them use
> it when print-circle is nil.  A couple of them used to.  print_object
> was changed to not use print-number-table unless print-circle is non-nil
> in commit 4ae29f89be.  byte-compile-output-docform which uses[...]

We try not to use hashes to reference commits (e.g., so that ChangeLogs
can be read without accessing the git repo).  I prefer date+subject, as
in

    There are only a few users of print-number-table, and none of them use
    it when print-circle is nil.  A couple of them used to.  print_object
    was changed in 2012-04-20 "* src/print.c (print_preprocess): Only check
    print_depth if print-circle is nil".  byte-compile-output-docform which
    uses[...]

You can also use "Action Stamps" though I find those not so human-readable
(theoretically, it's more machine-readable).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 5 Aug 2019 19:53:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 05 15:53:37 2019
Received: from localhost ([127.0.0.1]:35901 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1huj31-00075K-U4
	for submit <at> debbugs.gnu.org; Mon, 05 Aug 2019 15:53:37 -0400
Received: from aibo.runbox.com ([91.220.196.211]:59474)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gazally@HIDDEN>) id 1huj2x-000757-GJ
 for 36566 <at> debbugs.gnu.org; Mon, 05 Aug 2019 15:53:34 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; 
 s=rbselector1;
 h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From;
 bh=iuj7lfBo85Qo1WD8gO+u4ni/cZEfGHHAXw8ELl1tY6w=; b=VZTorOykIsj2AOi7ZkNcbtiFhS
 EeNowfKZUAFy7HiGbWBBr399VrXkYp934ba9IlCEinhUvd6cvl1lzLL0gVlY+3Z4Th4V2QS5SMpHY
 iYX9KfkAUbCxQWFTPsyvPrObu8IckrJxJDLS9+geCxZ9yisJ/m31S5Qdb6pIDkgGRpL+r0jYMzvYg
 RPp8mSPR8YXfiCMXVoEmGZCG3wh8V2CBLM0bEKMchjeI3Ntx2UWfPvXXCG100nc84jFuGUDX1aX+o
 Yiucn7XIKiEuonQddBuxnYTsDmojmUXAT+WVFdYWKzzEkTxWD+/nCPjWq1orhThENhvciu217XrrQ
 XyUcPkkw==;
Received: from [10.9.9.204] (helo=mailfront22.runbox)
 by mailtransmit02.runbox with esmtp (Exim 4.86_2)
 (envelope-from <gazally@HIDDEN>)
 id 1huj2t-0005RF-EE; Mon, 05 Aug 2019 21:53:27 +0200
Received: by mailfront22.runbox with esmtpsa (uid:179284 )
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1)
 id 1huj2l-0004sP-Ec; Mon, 05 Aug 2019 21:53:21 +0200
From: Gemini Lasswell <gazally@HIDDEN>
To: Noam Postavsky <npostavs@HIDDEN>
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
References: <87r26yvb4r.fsf@HIDDEN> <871ryy2l1t.fsf@HIDDEN>
 <87r26xjyon.fsf@HIDDEN> <877e8llbzo.fsf@HIDDEN>
 <8736ilaepu.fsf@HIDDEN> <87h871u24i.fsf@HIDDEN>
Date: Mon, 05 Aug 2019 12:53:08 -0700
In-Reply-To: <87h871u24i.fsf@HIDDEN> (Noam Postavsky's message of "Wed, 31
 Jul 2019 21:05:01 -0400")
Message-ID: <874l2vcrtn.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36566
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 36566 <at> debbugs.gnu.org,
 Stefan Monnier <monnier@HIDDEN>
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 (-)

--=-=-=
Content-Type: text/plain

Noam Postavsky <npostavs@HIDDEN> writes:

>>
>> ...by modifying the logic in print_preprocess to not create a hash table
>> if the top-level object is a string with no properties.
>
> This last idea sounds like a straightforward win to me, with no obvious
> drawbacks.  I mean, no point in allocating a hash table if we can
> cheaply detect it will never be used, right?

I made that change, and then, in studying the uses of
print-number-table, found more cases in which allocated hash tables were
never used.  Since 2011 when byte-compile-disable-print-circle was
marked obsolete and 2012 when commit 4ae29f89be changed the logic in
print_object, the only time print-number-table gets used is when
print-circle is non-nil.

Because of that observation, I have added a patch which makes it so that
print_preprocess is only called to create print-number-table when
print_circle is non-nil.  The patch also simplifies print_preprocess
accordingly.  In order to test that change thoroughly I added a couple
new print tests and reorganized the existing print tests so that all
functionality common between print.c and cl-print.el is now tested by
the same tests, located in src/print-tests.el.

Michael's use case is down to 0.7s on my machine.



--=-=-=
Content-Type: text/plain
Content-Disposition: attachment;
 filename=0001-Improve-print-output-options-commands-in-backtrace-m.patch

From 12c28d02ee7dc34133f5cd1352d6d65f86509bb7 Mon Sep 17 00:00:00 2001
From: Gemini Lasswell <gazally@HIDDEN>
Date: Tue, 30 Jul 2019 10:00:27 -0700
Subject: [PATCH 1/5] Improve print output options commands in backtrace-mode
 (bug#36566)

* lisp/emacs-lisp/backtrace.el (backtrace-view): Mention
:print-gensym in docstring.
(backtrace-mode-map): Add keyboard binding for
backtrace-toggle-print-gensym.  Add menu entries for
backtrace-toggle-print-circle and backtrace-toggle-print-gensym.
(backtrace--with-output-variables): Bind print-gensym with value
of :print-gensym found in view plist.
(backtrace-toggle-print-circle): Remove description of
implementation details from docstring.
(backtrace-toggle-print-gensym): New command.
(backtrace--toggle-feature): Add echo area message describing result
of command.

* test/lisp/emacs-lisp/backtrace-tests.el
(backtrace-tests--print-circle): New test.

* doc/lispref/debugging.texi (Backtraces): Document keyboard
binding for backtrace-toggle-print-gensym.
---
 doc/lispref/debugging.texi              |  3 ++
 lisp/emacs-lisp/backtrace.el            | 44 +++++++++++++++++-----
 test/lisp/emacs-lisp/backtrace-tests.el | 49 +++++++++++++++++++++++++
 3 files changed, 86 insertions(+), 10 deletions(-)

diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index 9e43343310..5393b2766a 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -457,6 +457,9 @@ Backtraces
 @item #
 Toggle @code{print-circle} for the frame at point.
 
+@item :
+Toggle @code{print-gensym} for the frame at point.
+
 @item .
 Expand all the forms abbreviated with ``...'' in the frame at point.
 
diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el
index 60d146e24a..0c4c7987c3 100644
--- a/lisp/emacs-lisp/backtrace.el
+++ b/lisp/emacs-lisp/backtrace.el
@@ -175,7 +175,8 @@ backtrace-frames
 
 (defvar-local backtrace-view nil
   "A plist describing how to render backtrace frames.
-Possible entries are :show-flags, :show-locals and :print-circle.")
+Possible entries are :show-flags, :show-locals, :print-circle
+and :print-gensym.")
 
 (defvar-local backtrace-insert-header-function nil
   "Function for inserting a header for the current Backtrace buffer.
@@ -205,6 +206,7 @@ backtrace-mode-map
     (define-key map "p" 'backtrace-backward-frame)
     (define-key map "v" 'backtrace-toggle-locals)
     (define-key map "#" 'backtrace-toggle-print-circle)
+    (define-key map ":" 'backtrace-toggle-print-gensym)
     (define-key map "s" 'backtrace-goto-source)
     (define-key map "\C-m" 'backtrace-help-follow-symbol)
     (define-key map "+" 'backtrace-multi-line)
@@ -224,6 +226,18 @@ backtrace-mode-map
          :active (backtrace-get-index)
          :selected (plist-get (backtrace-get-view) :show-locals)
          :help "Show or hide the local variables for the frame at point"]
+        ["Show Circular Structures" backtrace-toggle-print-circle
+         :style toggle
+         :active (backtrace-get-index)
+         :selected (plist-get (backtrace-get-view) :print-circle)
+         :help
+         "Condense or expand shared or circular structures in the frame at point"]
+        ["Show Uninterned Symbols" backtrace-toggle-print-gensym
+         :style toggle
+         :active (backtrace-get-index)
+         :selected (plist-get (backtrace-get-view) :print-gensym)
+         :help
+         "Toggle unique printing of uninterned symbols in the frame at point"]
         ["Expand \"...\"s" backtrace-expand-ellipses
          :help "Expand all the abbreviated forms in the current frame"]
         ["Show on Multiple Lines" backtrace-multi-line
@@ -339,6 +353,7 @@ backtrace--with-output-variables
   `(let ((print-escape-control-characters t)
          (print-escape-newlines t)
          (print-circle (plist-get ,view :print-circle))
+         (print-gensym (plist-get ,view :print-gensym))
          (standard-output (current-buffer)))
      ,@body))
 
@@ -420,12 +435,18 @@ backtrace--change-button-skip
 
 (defun backtrace-toggle-print-circle (&optional all)
   "Toggle `print-circle' for the backtrace frame at point.
-With prefix argument ALL, toggle the value of :print-circle in
-`backtrace-view', which affects all of the backtrace frames in
-the buffer."
+With prefix argument ALL, toggle the default value bound to
+`print-circle' for all the frames in the buffer."
   (interactive "P")
   (backtrace--toggle-feature :print-circle all))
 
+(defun backtrace-toggle-print-gensym (&optional all)
+  "Toggle `print-gensym' for the backtrace frame at point.
+With prefix argument ALL, toggle the default value bound to
+`print-gensym' for all the frames in the buffer."
+  (interactive "P")
+  (backtrace--toggle-feature :print-gensym all))
+
 (defun backtrace--toggle-feature (feature all)
   "Toggle FEATURE for the current backtrace frame or for the buffer.
 FEATURE should be one of the options in `backtrace-view'.  If ALL
@@ -450,12 +471,15 @@ backtrace--toggle-feature
           (goto-char (point-min))
           (while (and (not (eql index (backtrace-get-index)))
                       (< (point) (point-max)))
-            (goto-char (backtrace-get-frame-end)))))
-    (let ((index (backtrace-get-index)))
-      (unless index
-        (user-error "Not in a stack frame"))
-      (backtrace--set-feature feature
-                              (not (plist-get (backtrace-get-view) feature))))))
+            (goto-char (backtrace-get-frame-end))))
+        (message "%s is now %s for all frames"
+                 (substring (symbol-name feature) 1) value))
+    (unless (backtrace-get-index)
+      (user-error "Not in a stack frame"))
+    (let ((value (not (plist-get (backtrace-get-view) feature))))
+      (backtrace--set-feature feature value)
+      (message "%s is now %s for this frame"
+               (substring (symbol-name feature) 1) value))))
 
 (defun backtrace--set-feature (feature value)
   "Set FEATURE in the view plist of the frame at point to VALUE.
diff --git a/test/lisp/emacs-lisp/backtrace-tests.el b/test/lisp/emacs-lisp/backtrace-tests.el
index ce827e0166..be15495342 100644
--- a/test/lisp/emacs-lisp/backtrace-tests.el
+++ b/test/lisp/emacs-lisp/backtrace-tests.el
@@ -335,6 +335,55 @@ backtrace-tests--print-circle
       (should (string-match-p results
                               (backtrace-tests--get-substring (point-min) (point-max)))))))
 
+(ert-deftest backtrace-tests--print-gensym ()
+  "Backtrace buffers can toggle `print-gensym' syntax."
+  (ert-with-test-buffer (:name "print-gensym")
+    (let* ((print-gensym nil)
+           (arg (list (gensym "first") (gensym) (gensym "last")))
+           (results (backtrace-tests--make-regexp
+                     (backtrace-tests--result arg)))
+           (results-gensym (regexp-quote (let ((print-gensym t))
+                                           (backtrace-tests--result arg))))
+           (last-frame (backtrace-tests--make-regexp
+                        (format (nth (1- backtrace-tests--line-count)
+                                     (backtrace-tests--backtrace-lines))
+                                arg)))
+           (last-frame-gensym (regexp-quote
+                               (let ((print-gensym t))
+                                 (format (nth (1- backtrace-tests--line-count)
+                                              (backtrace-tests--backtrace-lines))
+                                         arg)))))
+      (backtrace-tests--make-backtrace arg)
+      (backtrace-print)
+      (should (string-match-p results
+                              (backtrace-tests--get-substring (point-min) (point-max))))
+      ;; Go to the last frame.
+      (goto-char (point-max))
+      (forward-line -1)
+      ;; Turn on print-gensym for that frame.
+      (backtrace-toggle-print-gensym)
+      (should (string-match-p last-frame-gensym
+                              (backtrace-tests--get-substring (point) (point-max))))
+      ;; Turn off print-gensym for the frame.
+      (backtrace-toggle-print-gensym)
+      (should (string-match-p last-frame
+                              (backtrace-tests--get-substring (point) (point-max))))
+      (should (string-match-p results
+                              (backtrace-tests--get-substring (point-min) (point-max))))
+      ;; Turn print-gensym on for the buffer.
+      (backtrace-toggle-print-gensym '(4))
+      (should (string-match-p last-frame-gensym
+                              (backtrace-tests--get-substring (point) (point-max))))
+      (should (string-match-p results-gensym
+                              (backtrace-tests--get-substring (point-min) (point-max))))
+      ;; Turn print-gensym off.
+      (backtrace-toggle-print-gensym '(4))
+      (should (string-match-p last-frame
+                              (backtrace-tests--get-substring
+                               (point) (+ (point) (length last-frame)))))
+      (should (string-match-p results
+                              (backtrace-tests--get-substring (point-min) (point-max)))))))
+
 (defun backtrace-tests--make-regexp (str)
   "Make regexp from STR for `backtrace-tests--print-circle'.
 Used for results of printing circular objects without
-- 
2.19.2


--=-=-=
Content-Type: text/plain
Content-Disposition: attachment;
 filename=0002-Improve-performance-of-backtrace-printing-bug-36566.patch

From 99a05473fe9c5aef5619585733265c715ac93f01 Mon Sep 17 00:00:00 2001
From: Gemini Lasswell <gazally@HIDDEN>
Date: Tue, 30 Jul 2019 11:56:51 -0700
Subject: [PATCH 2/5] Improve performance of backtrace printing (bug#36566)

* lisp/emacs-lisp/cl-print.el (cl-print-to-string-with-limit): Reduce
print-level and print-length more quickly when the structure being
printed is very large.
---
 lisp/emacs-lisp/cl-print.el | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/lisp/emacs-lisp/cl-print.el b/lisp/emacs-lisp/cl-print.el
index 5fe3dd1b91..530770128e 100644
--- a/lisp/emacs-lisp/cl-print.el
+++ b/lisp/emacs-lisp/cl-print.el
@@ -548,21 +548,22 @@ cl-print-to-string-with-limit
   ;; call_debugger (bug#31919).
   (let* ((print-length (when limit (min limit 50)))
          (print-level (when limit (min 8 (truncate (log limit)))))
-         (delta (when limit
-                  (max 1 (truncate (/ print-length print-level))))))
+         (delta-length (when limit
+                         (max 1 (truncate (/ print-length print-level))))))
     (with-temp-buffer
       (catch 'done
         (while t
           (erase-buffer)
           (funcall print-function value (current-buffer))
-          ;; Stop when either print-level is too low or the value is
-          ;; successfully printed in the space allowed.
-          (when (or (not limit)
-                    (< (- (point-max) (point-min)) limit)
-                    (= print-level 2))
-            (throw 'done (buffer-string)))
-          (cl-decf print-level)
-          (cl-decf print-length delta))))))
+          (let ((result (- (point-max) (point-min))))
+            ;; Stop when either print-level is too low or the value is
+            ;; successfully printed in the space allowed.
+            (when (or (not limit) (< result limit) (<= print-level 2))
+              (throw 'done (buffer-string)))
+            (let* ((ratio (/ result limit))
+                   (delta-level (max 1 (min (- print-level 2) ratio))))
+              (cl-decf print-level delta-level)
+              (cl-decf print-length (* delta-length delta-level)))))))))
 
 (provide 'cl-print)
 ;;; cl-print.el ends here
-- 
2.19.2


--=-=-=
Content-Type: text/plain
Content-Disposition: attachment;
 filename=0003-Fix-unnecessary-hash-table-creation-in-cl-prin1-bug-.patch

From f6938cbc35b31c6c22dc36fc28c50e5e3cbfa3c1 Mon Sep 17 00:00:00 2001
From: Gemini Lasswell <gazally@HIDDEN>
Date: Sat, 3 Aug 2019 12:33:20 -0700
Subject: [PATCH 3/5] Fix unnecessary hash table creation in cl-prin1
 (bug#36566)

cl-prin1 prints all its punctuation by passing strings to prin1.  When
print-circle was set, print_preprocess was creating a new hash table
for each string, causing excessive garbage collection when printing
large Lisp objects with cl-prin1.

* src/print.c (print_number_index): Fix typo in comment above.
(PRINT_CIRCLE_CANDIDATE_P): Don't create print_number_table
for top-level strings with no properties, except when
print_continuous_numbering is on.
---
 src/print.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/print.c b/src/print.c
index 7c3da68fc9..18330b0fbf 100644
--- a/src/print.c
+++ b/src/print.c
@@ -81,7 +81,7 @@ #define PRINT_CIRCLE 200
      -N   the object will be printed several times and will take number N.
      N    the object has been printed so we can refer to it as #N#.
    print_number_index holds the largest N already used.
-   N has to be striclty larger than 0 since we need to distinguish -N.  */
+   N has to be strictly larger than 0 since we need to distinguish -N.  */
 static ptrdiff_t print_number_index;
 static void print_interval (INTERVAL interval, Lisp_Object printcharfun);
 
@@ -1149,7 +1149,11 @@ print (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
 }
 
 #define PRINT_CIRCLE_CANDIDATE_P(obj)			   \
-  (STRINGP (obj) || CONSP (obj)				   \
+  ((STRINGP (obj)                                          \
+       && (string_intervals (obj)                          \
+	  || print_depth > 1				   \
+	  || Vprint_continuous_numbering))		   \
+   || CONSP (obj)					   \
    || (VECTORLIKEP (obj)				   \
        && (VECTORP (obj) || COMPILEDP (obj)		   \
 	   || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) \
-- 
2.19.2


--=-=-=
Content-Type: text/plain
Content-Disposition: attachment;
 filename=0004-Create-common-tests-for-print.c-and-cl-print.el.patch

From fe609299d83df807b0c5dde948a4d753f94f7511 Mon Sep 17 00:00:00 2001
From: Gemini Lasswell <gazally@HIDDEN>
Date: Sun, 4 Aug 2019 15:56:12 -0700
Subject: [PATCH 4/5] Create common tests for print.c and cl-print.el

* test/lisp/emacs-lisp/cl-print-tests.el:
(cl-print--test, cl-print-tests-1, cl-print-tests-2)
(cl-print-tests-3, cl-print-tests-4, cl-print-tests-5)
(cl-print-tests-strings, cl-print-circle, cl-print-circle-2):
Remove.
* test/src/print-tests.el (print-tests--prin1-to-string): New
alias.
(print-tests--deftest): New macro.
(print-hex-backslash, print-read-roundtrip, print-bignum): Define with
print-tests--deftest and use print-tests--prin1-to-string.
(print-tests--prints-with-charset-p): Use
print-tests--prin1-to-string.
(print-tests--print-charset-text-property-nil)
(print-tests--print-charset-text-property-t)
(print-tests--print-charset-text-property-default): Define with
print-tests--deftest.
(print-tests-print-gensym)
(print-tests-continuous-numbering, print-tests-1, print-tests-2)
(print-tests-3, print-tests-4, print-tests-5)
(print-tests-strings, print-circle, print-circle-2): New tests.
(print--test, print-tests-struct): New cl-defstructs.
---
 test/lisp/emacs-lisp/cl-print-tests.el | 115 +----------
 test/src/print-tests.el                | 259 +++++++++++++++++++++++--
 2 files changed, 250 insertions(+), 124 deletions(-)

diff --git a/test/lisp/emacs-lisp/cl-print-tests.el b/test/lisp/emacs-lisp/cl-print-tests.el
index 406c528dce..31d79df71b 100644
--- a/test/lisp/emacs-lisp/cl-print-tests.el
+++ b/test/lisp/emacs-lisp/cl-print-tests.el
@@ -19,109 +19,17 @@
 
 ;;; Commentary:
 
+;; See test/src/print-tests.el for tests which apply to both
+;; cl-print.el and src/print.c.
+
 ;;; Code:
 
 (require 'ert)
 
-(cl-defstruct cl-print--test a b)
-
-(ert-deftest cl-print-tests-1 ()
-  "Test cl-print code."
-  (let ((x (make-cl-print--test :a 1 :b 2)))
-    (let ((print-circle nil))
-      (should (equal (cl-prin1-to-string `((x . ,x) (y . ,x)))
-                     "((x . #s(cl-print--test :a 1 :b 2)) (y . #s(cl-print--test :a 1 :b 2)))")))
-    (let ((print-circle t))
-      (should (equal (cl-prin1-to-string `((x . ,x) (y . ,x)))
-                     "((x . #1=#s(cl-print--test :a 1 :b 2)) (y . #1#))")))
-    (should (string-match "\\`#f(compiled-function (x) \"[^\"]+\" [^)]*)\\'"
-                          (cl-prin1-to-string (symbol-function #'caar))))))
-
-(ert-deftest cl-print-tests-2 ()
-  (let ((x (record 'foo 1 2 3)))
-    (should (equal
-             x
-             (car (read-from-string (with-output-to-string (prin1 x))))))
-    (let ((print-circle t))
-      (should (string-match
-               "\\`(#1=#s(foo 1 2 3) #1#)\\'"
-               (cl-prin1-to-string (list x x)))))))
-
 (cl-defstruct (cl-print-tests-struct
                (:constructor cl-print-tests-con))
   a b c d e)
 
-(ert-deftest cl-print-tests-3 ()
-  "CL printing observes `print-length'."
-  (let ((long-list (make-list 5 'a))
-        (long-vec (make-vector 5 'b))
-        (long-struct (cl-print-tests-con))
-        (long-string (make-string 5 ?a))
-        (print-length 4))
-    (should (equal "(a a a a ...)" (cl-prin1-to-string long-list)))
-    (should (equal "[b b b b ...]" (cl-prin1-to-string long-vec)))
-    (should (equal "#s(cl-print-tests-struct :a nil :b nil :c nil :d nil ...)"
-                   (cl-prin1-to-string long-struct)))
-    (should (equal "\"aaaa...\"" (cl-prin1-to-string long-string)))))
-
-(ert-deftest cl-print-tests-4 ()
-  "CL printing observes `print-level'."
-  (let* ((deep-list '(a (b (c (d (e))))))
-         (buried-vector '(a (b (c (d [e])))))
-         (deep-struct (cl-print-tests-con))
-         (buried-struct `(a (b (c (d ,deep-struct)))))
-         (buried-string '(a (b (c (d #("hello" 0 5 (cl-print-test t)))))))
-         (buried-simple-string '(a (b (c (d "hello")))))
-         (print-level 4))
-    (setf (cl-print-tests-struct-a deep-struct) deep-list)
-    (should (equal "(a (b (c (d ...))))" (cl-prin1-to-string deep-list)))
-    (should (equal "(a (b (c (d ...))))" (cl-prin1-to-string buried-vector)))
-    (should (equal "(a (b (c (d ...))))" (cl-prin1-to-string buried-struct)))
-    (should (equal "(a (b (c (d ...))))" (cl-prin1-to-string buried-string)))
-    (should (equal "(a (b (c (d \"hello\"))))"
-                   (cl-prin1-to-string buried-simple-string)))
-    (should (equal "#s(cl-print-tests-struct :a (a (b (c ...))) :b nil :c nil :d nil :e nil)"
-                   (cl-prin1-to-string deep-struct)))))
-
-(ert-deftest cl-print-tests-5 ()
-  "CL printing observes `print-quoted'."
-  (let ((quoted-stuff '('a #'b `(,c ,@d))))
-    (let ((print-quoted t))
-      (should (equal "('a #'b `(,c ,@d))"
-                     (cl-prin1-to-string quoted-stuff))))
-    (let ((print-quoted nil))
-      (should (equal "((quote a) (function b) (\\` ((\\, c) (\\,@ d))))"
-                     (cl-prin1-to-string quoted-stuff))))))
-
-(ert-deftest cl-print-tests-strings ()
-  "CL printing prints strings and propertized strings."
-  (let* ((str1 "abcdefghij")
-         (str2 #("abcdefghij" 3 6 (bold t) 7 9 (italic t)))
-         (str3 #("abcdefghij" 0 10 (test t)))
-         (obj '(a b))
-         ;; Since the byte compiler reuses string literals,
-         ;; and the put-text-property call is destructive, use
-         ;; copy-sequence to make a new string.
-         (str4 (copy-sequence "abcdefghij")))
-    (put-text-property 0 5 'test obj str4)
-    (put-text-property 7 10 'test obj str4)
-
-    (should (equal "\"abcdefghij\"" (cl-prin1-to-string str1)))
-    (should (equal "#(\"abcdefghij\" 3 6 (bold t) 7 9 (italic t))"
-                   (cl-prin1-to-string str2)))
-    (should (equal "#(\"abcdefghij\" 0 10 (test t))"
-                   (cl-prin1-to-string str3)))
-    (let ((print-circle nil))
-      (should
-       (equal
-        "#(\"abcdefghij\" 0 5 (test (a b)) 7 10 (test (a b)))"
-        (cl-prin1-to-string str4))))
-    (let ((print-circle t))
-      (should
-       (equal
-        "#(\"abcdefghij\" 0 5 (test #1=(a b)) 7 10 (test #1#))"
-        (cl-prin1-to-string str4))))))
-
 (ert-deftest cl-print-tests-ellipsis-cons ()
   "Ellipsis expansion works in conses."
   (let ((print-length 4)
@@ -216,23 +124,6 @@ cl-print-tests-check-ellipsis-expansion-rx
     (should (string-match expanded (with-output-to-string
                                      (cl-print-expand-ellipsis value nil))))))
 
-(ert-deftest cl-print-circle ()
-  (let ((x '(#1=(a . #1#) #1#)))
-    (let ((print-circle nil))
-      (should (string-match "\\`((a . #[0-9]) (a . #[0-9]))\\'"
-                            (cl-prin1-to-string x))))
-    (let ((print-circle t))
-      (should (equal "(#1=(a . #1#) #1#)" (cl-prin1-to-string x))))))
-
-(ert-deftest cl-print-circle-2 ()
-  ;; Bug#31146.
-  (let ((x '(0 . #1=(0 . #1#))))
-    (let ((print-circle nil))
-      (should (string-match "\\`(0 0 . #[0-9])\\'"
-                            (cl-prin1-to-string x))))
-    (let ((print-circle t))
-      (should (equal "(0 . #1=(0 . #1#))" (cl-prin1-to-string x))))))
-
 (ert-deftest cl-print-tests-print-to-string-with-limit ()
   (let* ((thing10 (make-list 10 'a))
          (thing100 (make-list 100 'a))
diff --git a/test/src/print-tests.el b/test/src/print-tests.el
index 8e377d7180..26d49a5ffb 100644
--- a/test/src/print-tests.el
+++ b/test/src/print-tests.el
@@ -21,42 +21,86 @@
 
 (require 'ert)
 
-(ert-deftest print-hex-backslash ()
+;; Support sharing test code with cl-print-tests.
+
+(defalias 'print-tests--prin1-to-string #'identity
+  "The function to print to a string which is under test.")
+
+(defmacro print-tests--deftest (name arg &rest docstring-keys-and-body)
+  "Test both print.c and cl-print.el at once."
+  (declare (debug ert-deftest)
+           (doc-string 3)
+           (indent 2))
+  (let ((clname (intern (concat (symbol-name name) "-cl-print")))
+        (doc (when (stringp (car-safe docstring-keys-and-body))
+               (list (pop docstring-keys-and-body))))
+        (keys-and-values nil))
+    (while (keywordp (car-safe docstring-keys-and-body))
+      (let ((key (pop docstring-keys-and-body))
+            (val (pop docstring-keys-and-body)))
+        (push val keys-and-values)
+        (push key keys-and-values)))
+    `(progn
+       ;; Set print-tests--prin1-to-string at both declaration and
+       ;; runtime, so that it can be used by the :expected-result
+       ;; keyword.
+       (cl-letf (((symbol-function #'print-tests--prin1-to-string)
+                  #'prin1-to-string))
+         (ert-deftest ,name ,arg
+           ,@doc
+           ,@keys-and-values
+           (cl-letf (((symbol-function #'print-tests--prin1-to-string)
+                      #'prin1-to-string))
+             ,@docstring-keys-and-body)))
+       (cl-letf (((symbol-function #'print-tests--prin1-to-string)
+                  #'cl-prin1-to-string))
+         (ert-deftest ,clname ,arg
+           ,@doc
+           ,@keys-and-values
+           (cl-letf (((symbol-function #'print-tests--prin1-to-string)
+                      #'cl-prin1-to-string))
+             ,@docstring-keys-and-body))))))
+
+(print-tests--deftest print-hex-backslash ()
   (should (string= (let ((print-escape-multibyte t)
                          (print-escape-newlines t))
-                     (prin1-to-string "\u00A2\ff"))
+                     (print-tests--prin1-to-string "\u00A2\ff"))
                    "\"\\x00a2\\ff\"")))
 
 (defun print-tests--prints-with-charset-p (ch odd-charset)
-  "Return t if `prin1-to-string' prints CH with the `charset' property.
+  "Return t if print function being tested prints CH with the `charset' property.
 CH is propertized with a `charset' value according to
 ODD-CHARSET: if nil, then use the one returned by `char-charset',
 otherwise, use a different charset."
   (integerp
    (string-match
     "charset"
-    (prin1-to-string
+    (print-tests--prin1-to-string
      (propertize (string ch)
                  'charset
                  (if odd-charset
                      (cl-find (char-charset ch) charset-list :test-not #'eq)
                    (char-charset ch)))))))
 
-(ert-deftest print-charset-text-property-nil ()
+(print-tests--deftest print-charset-text-property-nil ()
+  :expected-result (if (eq (symbol-function #'print-tests--prin1-to-string)
+                           #'cl-prin1-to-string) :failed :passed)
   (let ((print-charset-text-property nil))
     (should-not (print-tests--prints-with-charset-p ?\xf6 t)) ; Bug#31376.
     (should-not (print-tests--prints-with-charset-p ?a t))
     (should-not (print-tests--prints-with-charset-p ?\xf6 nil))
     (should-not (print-tests--prints-with-charset-p ?a nil))))
 
-(ert-deftest print-charset-text-property-default ()
+(print-tests--deftest print-charset-text-property-default ()
+  :expected-result (if (eq (symbol-function #'print-tests--prin1-to-string)
+                           #'cl-prin1-to-string) :failed :passed)
   (let ((print-charset-text-property 'default))
     (should (print-tests--prints-with-charset-p ?\xf6 t))
     (should-not (print-tests--prints-with-charset-p ?a t))
     (should-not (print-tests--prints-with-charset-p ?\xf6 nil))
     (should-not (print-tests--prints-with-charset-p ?a nil))))
 
-(ert-deftest print-charset-text-property-t ()
+(print-tests--deftest print-charset-text-property-t ()
   (let ((print-charset-text-property t))
     (should (print-tests--prints-with-charset-p ?\xf6 t))
     (should (print-tests--prints-with-charset-p ?a t))
@@ -94,7 +138,7 @@ terpri
                        (buffer-string))
                      "--------\n"))))
 
-(ert-deftest print-read-roundtrip ()
+(print-tests--deftest print-read-roundtrip ()
   (let ((syms (list '## '& '* '+ '- '/ '0E '0e '< '= '> 'E 'E0 'NaN '\"
                     '\# '\#x0 '\' '\'\' '\( '\) '\+00 '\, '\-0 '\. '\.0
                     '\0 '\0.0 '\0E0 '\0e0 '\1E+ '\1E+NaN '\1e+ '\1e+NaN
@@ -105,16 +149,207 @@ print-read-roundtrip
                     (intern "\N{ZERO WIDTH SPACE}")
                     (intern "\0"))))
     (dolist (sym syms)
-      (should (eq (read (prin1-to-string sym)) sym))
+      (should (eq (read (print-tests--prin1-to-string sym)) sym))
       (dolist (sym1 syms)
         (let ((sym2 (intern (concat (symbol-name sym) (symbol-name sym1)))))
-          (should (eq (read (prin1-to-string sym2)) sym2)))))))
+          (should (eq (read (print-tests--prin1-to-string sym2)) sym2)))))))
 
-(ert-deftest print-bignum ()
+(print-tests--deftest print-bignum ()
   (let* ((str "999999999999999999999999999999999")
          (val (read str)))
     (should (> val most-positive-fixnum))
-    (should (equal (prin1-to-string val) str))))
+    (should (equal (print-tests--prin1-to-string val) str))))
+
+(print-tests--deftest print-tests-print-gensym ()
+  "Printing observes `print-gensym'."
+  (let* ((sym1 (gensym))
+         (syms (list sym1 (gensym "x") (make-symbol "y") sym1)))
+    (let* ((print-circle nil)
+           (printed-with (let ((print-gensym t))
+                           (print-tests--prin1-to-string syms)))
+           (printed-without (let ((print-gensym nil))
+                              (print-tests--prin1-to-string syms))))
+      (should (string-match
+               "(#:\\(g[[:digit:]]+\\) #:x[[:digit:]]+ #:y #:\\(g[[:digit:]]+\\))$"
+               printed-with))
+      (should (string= (match-string 1 printed-with)
+                       (match-string 2 printed-with)))
+      (should (string-match "(g[[:digit:]]+ x[[:digit:]]+ y g[[:digit:]]+)$"
+                            printed-without)))
+    (let* ((print-circle t)
+           (printed-with (let ((print-gensym t))
+                           (print-tests--prin1-to-string syms)))
+           (printed-without (let ((print-gensym nil))
+                              (print-tests--prin1-to-string syms))))
+      (should (string-match "(#1=#:g[[:digit:]]+ #:x[[:digit:]]+ #:y #1#)$"
+                            printed-with))
+      (should (string-match "(g[[:digit:]]+ x[[:digit:]]+ y g[[:digit:]]+)$"
+                            printed-without)))))
+
+(print-tests--deftest print-tests-continuous-numbering ()
+  "Printing observes `print-continuous-numbering'."
+  ;; cl-print does not support print-continuous-numbering.
+  :expected-result (if (eq (symbol-function #'print-tests--prin1-to-string)
+                           #'cl-prin1-to-string) :failed :passed)
+  (let* ((x (list 1))
+         (y "hello")
+         (g (gensym))
+         (g2 (gensym))
+         (print-circle t)
+         (print-gensym t))
+    (let ((print-continuous-numbering t)
+          (print-number-table nil))
+      (should (string-match
+               "(#1=(1) #1# #2=\"hello\" #2#)(#3=#:g[[:digit:]]+ #3#)(#1# #2# #3#)#2#$"
+               (mapconcat #'print-tests--prin1-to-string `((,x ,x ,y ,y) (,g ,g) (,x ,y ,g) ,y) ""))))
+
+    ;; This is the special case for byte-compile-output-docform
+    ;; mentioned in a comment in print_preprocess.  When
+    ;; print-continuous-numbering and print-circle and print-gensym
+    ;; are all non-nil, print all gensyms with numbers even if they
+    ;; only occur once.
+    (let ((print-continuous-numbering t)
+          (print-number-table nil))
+      (should (string-match
+               "(#1=#:g[[:digit:]]+ #2=#:g[[:digit:]]+)$"
+               (print-tests--prin1-to-string (list g g2)))))))
+
+(cl-defstruct print--test a b)
+
+(print-tests--deftest print-tests-1 ()
+  "Test print code."
+  (let ((x (make-print--test :a 1 :b 2))
+        (rec (cond
+              ((eq (symbol-function #'print-tests--prin1-to-string) 'prin1-to-string)
+               "#s(print--test 1 2)")
+              ((eq (symbol-function #'print-tests--prin1-to-string) 'cl-prin1-to-string)
+               "#s(print--test :a 1 :b 2)")
+              (t (cl-assert nil)))))
+
+    (let ((print-circle nil))
+      (should (equal (print-tests--prin1-to-string `((x . ,x) (y . ,x)))
+                     (format "((x . %s) (y . %s))" rec rec))))
+    (let ((print-circle t))
+      (should (equal (print-tests--prin1-to-string `((x . ,x) (y . ,x)))
+                     (format "((x . #1=%s) (y . #1#))" rec))))))
+
+(print-tests--deftest print-tests-2 ()
+  (let ((x (record 'foo 1 2 3)))
+    (should (equal
+             x
+             (car (read-from-string (with-output-to-string (prin1 x))))))
+    (let ((print-circle t))
+      (should (string-match
+               "\\`(#1=#s(foo 1 2 3) #1#)\\'"
+               (print-tests--prin1-to-string (list x x)))))))
+
+(cl-defstruct (print-tests-struct
+               (:constructor print-tests-con))
+  a b c d e)
+
+(print-tests--deftest print-tests-3 ()
+  "Printing observes `print-length'."
+  (let ((long-list (make-list 5 'a))
+        (long-vec (make-vector 5 'b))
+        ;; (long-struct (print-tests-con))
+        ;; (long-string (make-string 5 ?a))
+        (print-length 4))
+    (should (equal "(a a a a ...)" (print-tests--prin1-to-string long-list)))
+    (should (equal "[b b b b ...]" (print-tests--prin1-to-string long-vec)))
+    ;; This one only prints 3 nils. Should it print 4?
+    ;; (should (equal "#s(print-tests-struct nil nil nil nil ...)"
+    ;;                (print-tests--prin1-to-string long-struct)))
+    ;; This one is only supported by cl-print
+    ;; (should (equal "\"aaaa...\"" (cl-print-tests--prin1-to-string long-string)))
+    ))
+
+(print-tests--deftest print-tests-4 ()
+  "Printing observes `print-level'."
+  (let* ((deep-list '(a (b (c (d (e))))))
+         (buried-vector '(a (b (c (d [e])))))
+         (deep-struct (print-tests-con))
+         (buried-struct `(a (b (c (d ,deep-struct)))))
+         (buried-string '(a (b (c (d #("hello" 0 5 (print-test t)))))))
+         (buried-simple-string '(a (b (c (d "hello")))))
+         (print-level 4))
+    (setf (print-tests-struct-a deep-struct) deep-list)
+    (should (equal "(a (b (c (d ...))))" (print-tests--prin1-to-string deep-list)))
+    (should (equal "(a (b (c (d \"hello\"))))"
+                   (print-tests--prin1-to-string buried-simple-string)))
+    (cond
+     ((eq (symbol-function #'print-tests--prin1-to-string) #'prin1-to-string)
+      (should (equal "(a (b (c (d [e]))))" (print-tests--prin1-to-string buried-vector)))
+      (should (equal "(a (b (c (d #s(print-tests-struct ... nil nil nil nil)))))"
+                     (print-tests--prin1-to-string buried-struct)))
+      (should (equal "(a (b (c (d #(\"hello\" 0 5 ...)))))"
+                     (print-tests--prin1-to-string buried-string)))
+      (should (equal "#s(print-tests-struct (a (b (c ...))) nil nil nil nil)"
+                     (print-tests--prin1-to-string deep-struct))))
+
+     ((eq (symbol-function #'print-tests--prin1-to-string) #'cl-prin1-to-string)
+      (should (equal "(a (b (c (d ...))))" (print-tests--prin1-to-string buried-vector)))
+      (should (equal "(a (b (c (d ...))))" (print-tests--prin1-to-string buried-struct)))
+      (should (equal "(a (b (c (d ...))))" (print-tests--prin1-to-string buried-string)))
+      (should (equal "#s(print-tests-struct :a (a (b (c ...))) :b nil :c nil :d nil :e nil)"
+                     (print-tests--prin1-to-string deep-struct))))
+     (t (cl-assert nil)))))
+
+(print-tests--deftest print-tests-5 ()
+  "Printing observes `print-quoted'."
+  (let ((quoted-stuff '('a #'b `(,c ,@d))))
+    (let ((print-quoted t))
+      (should (equal "('a #'b `(,c ,@d))"
+                     (print-tests--prin1-to-string quoted-stuff))))
+    (let ((print-quoted nil))
+      (should (equal "((quote a) (function b) (\\` ((\\, c) (\\,@ d))))"
+                     (print-tests--prin1-to-string quoted-stuff))))))
+
+(print-tests--deftest print-tests-strings ()
+  "Can print strings and propertized strings."
+  (let* ((str1 "abcdefghij")
+         (str2 #("abcdefghij" 3 6 (bold t) 7 9 (italic t)))
+         (str3 #("abcdefghij" 0 10 (test t)))
+         (obj '(a b))
+         ;; Since the byte compiler reuses string literals,
+         ;; and the put-text-property call is destructive, use
+         ;; copy-sequence to make a new string.
+         (str4 (copy-sequence "abcdefghij")))
+    (put-text-property 0 5 'test obj str4)
+    (put-text-property 7 10 'test obj str4)
+
+    (should (equal "\"abcdefghij\"" (print-tests--prin1-to-string str1)))
+    (should (equal "#(\"abcdefghij\" 3 6 (bold t) 7 9 (italic t))"
+                   (print-tests--prin1-to-string str2)))
+    (should (equal "#(\"abcdefghij\" 0 10 (test t))"
+                   (print-tests--prin1-to-string str3)))
+    (let ((print-circle nil))
+      (should
+       (equal
+        "#(\"abcdefghij\" 0 5 (test (a b)) 7 10 (test (a b)))"
+        (print-tests--prin1-to-string str4))))
+    (let ((print-circle t))
+      (should
+       (equal
+        "#(\"abcdefghij\" 0 5 (test #1=(a b)) 7 10 (test #1#))"
+        (print-tests--prin1-to-string str4))))))
+
+(print-tests--deftest print-circle ()
+  (let ((x '(#1=(a . #1#) #1#)))
+    (let ((print-circle nil))
+      (should (string-match "\\`((a . #[0-9]) (a . #[0-9]))\\'"
+                            (print-tests--prin1-to-string x))))
+    (let ((print-circle t))
+      (should (equal "(#1=(a . #1#) #1#)" (print-tests--prin1-to-string x))))))
+
+(print-tests--deftest print-circle-2 ()
+   ;; Bug#31146.
+  (let ((x '(0 . #1=(0 . #1#))))
+    (let ((print-circle nil))
+      (should (string-match "\\`(0 0 . #[0-9])\\'"
+                            (print-tests--prin1-to-string x))))
+    (let ((print-circle t))
+      (should (equal "(0 . #1=(0 . #1#))" (print-tests--prin1-to-string x))))))
+
 
 (provide 'print-tests)
 ;;; print-tests.el ends here
-- 
2.19.2


--=-=-=
Content-Type: text/plain
Content-Disposition: attachment;
 filename=0005-Don-t-build-print-number-table-unless-it-will-be-use.patch

From 1daf6a369e1fb23a2a761b2cd5fc0bdbbc8bb877 Mon Sep 17 00:00:00 2001
From: Gemini Lasswell <gazally@HIDDEN>
Date: Sat, 3 Aug 2019 21:39:29 -0700
Subject: [PATCH 5/5] Don't build print-number-table unless it will be used

There are only a few users of print-number-table, and none of them use
it when print-circle is nil.  A couple of them used to.  print_object
was changed to not use print-number-table unless print-circle is non-nil
in commit 4ae29f89be.  byte-compile-output-docform which uses
print-number-table binds print-circle to t before printing unless
byte-compile-disable-print-circle is set, but that variable has been
marked obsolete since 24.1.

* src/print.c (print_preprocess): Assert Vprint_circle is non-nil.
Remove code handling the case when Vprint_circle is nil.
(print, Fprint_preprocess): Don't call print_preprocess unless
Vprint_circle is non-nil.
(print_object): Remove comment referencing removed code in
print_preprocess.
---
 src/print.c | 92 +++++++++++++++++++++++------------------------------
 1 file changed, 39 insertions(+), 53 deletions(-)

diff --git a/src/print.c b/src/print.c
index 18330b0fbf..c870aa5a08 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1120,8 +1120,8 @@ print (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
       Vprint_number_table = Qnil;
     }
 
-  /* Construct Vprint_number_table for print-gensym and print-circle.  */
-  if (!NILP (Vprint_gensym) || !NILP (Vprint_circle))
+  /* Construct Vprint_number_table for print-circle.  */
+  if (!NILP (Vprint_circle))
     {
       /* Construct Vprint_number_table.
 	 This increments print_number_index for the objects added.  */
@@ -1163,13 +1163,14 @@ #define PRINT_CIRCLE_CANDIDATE_P(obj)			   \
        && SYMBOLP (obj)					   \
        && !SYMBOL_INTERNED_P (obj)))
 
-/* Construct Vprint_number_table according to the structure of OBJ.
-   OBJ itself and all its elements will be added to Vprint_number_table
-   recursively if it is a list, vector, compiled function, char-table,
-   string (its text properties will be traced), or a symbol that has
-   no obarray (this is for the print-gensym feature).
-   The status fields of Vprint_number_table mean whether each object appears
-   more than once in OBJ: Qnil at the first time, and Qt after that.  */
+/* Construct Vprint_number_table for the print-circle feature
+   according to the structure of OBJ.  OBJ itself and all its elements
+   will be added to Vprint_number_table recursively if it is a list,
+   vector, compiled function, char-table, string (its text properties
+   will be traced), or a symbol that has no obarray (this is for the
+   print-gensym feature).  The status fields of Vprint_number_table
+   mean whether each object appears more than once in OBJ: Qnil at the
+   first time, and Qt after that.  */
 static void
 print_preprocess (Lisp_Object obj)
 {
@@ -1178,20 +1179,7 @@ print_preprocess (Lisp_Object obj)
   int loop_count = 0;
   Lisp_Object halftail;
 
-  /* Avoid infinite recursion for circular nested structure
-     in the case where Vprint_circle is nil.  */
-  if (NILP (Vprint_circle))
-    {
-      /* Give up if we go so deep that print_object will get an error.  */
-      /* See similar code in print_object.  */
-      if (print_depth >= PRINT_CIRCLE)
-	error ("Apparently circular structure being printed");
-
-      for (i = 0; i < print_depth; i++)
-	if (EQ (obj, being_printed[i]))
-	  return;
-      being_printed[print_depth] = obj;
-    }
+  eassert (!NILP (Vprint_circle));
 
   print_depth++;
   halftail = obj;
@@ -1202,33 +1190,28 @@ print_preprocess (Lisp_Object obj)
       if (!HASH_TABLE_P (Vprint_number_table))
 	Vprint_number_table = CALLN (Fmake_hash_table, QCtest, Qeq);
 
-      /* In case print-circle is nil and print-gensym is t,
-	 add OBJ to Vprint_number_table only when OBJ is a symbol.  */
-      if (! NILP (Vprint_circle) || SYMBOLP (obj))
-	{
-	  Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil);
-	  if (!NILP (num)
-	      /* If Vprint_continuous_numbering is non-nil and OBJ is a gensym,
-		 always print the gensym with a number.  This is a special for
-		 the lisp function byte-compile-output-docform.  */
-	      || (!NILP (Vprint_continuous_numbering)
-		  && SYMBOLP (obj)
-		  && !SYMBOL_INTERNED_P (obj)))
-	    { /* OBJ appears more than once.	Let's remember that.  */
-	      if (!FIXNUMP (num))
-		{
-		  print_number_index++;
-		  /* Negative number indicates it hasn't been printed yet.  */
-		  Fputhash (obj, make_fixnum (- print_number_index),
-			    Vprint_number_table);
-		}
-	      print_depth--;
-	      return;
+      Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil);
+      if (!NILP (num)
+	  /* If Vprint_continuous_numbering is non-nil and OBJ is a gensym,
+	     always print the gensym with a number.  This is a special for
+	     the lisp function byte-compile-output-docform.  */
+	  || (!NILP (Vprint_continuous_numbering)
+	      && SYMBOLP (obj)
+	      && !SYMBOL_INTERNED_P (obj)))
+	{ /* OBJ appears more than once.  Let's remember that.  */
+	  if (!FIXNUMP (num))
+	    {
+	      print_number_index++;
+	      /* Negative number indicates it hasn't been printed yet.  */
+	      Fputhash (obj, make_fixnum (- print_number_index),
+			Vprint_number_table);
 	    }
-	  else
-	    /* OBJ is not yet recorded.  Let's add to the table.  */
-	    Fputhash (obj, Qt, Vprint_number_table);
+	  print_depth--;
+	  return;
 	}
+      else
+	/* OBJ is not yet recorded.  Let's add to the table.  */
+	Fputhash (obj, Qt, Vprint_number_table);
 
       switch (XTYPE (obj))
 	{
@@ -1275,11 +1258,15 @@ print_preprocess (Lisp_Object obj)
 
 DEFUN ("print--preprocess", Fprint_preprocess, Sprint_preprocess, 1, 1, 0,
        doc: /* Extract sharing info from OBJECT needed to print it.
-Fills `print-number-table'.  */)
-  (Lisp_Object object)
+Fills `print-number-table' if `print-circle' is non-nil.  Does nothing
+if `print-circle' is nil.  */)
+     (Lisp_Object object)
 {
-  print_number_index = 0;
-  print_preprocess (object);
+  if (!NILP (Vprint_circle))
+    {
+      print_number_index = 0;
+      print_preprocess (object);
+    }
   return Qnil;
 }
 
@@ -1864,7 +1851,6 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
       /* Simple but incomplete way.  */
       int i;
 
-      /* See similar code in print_preprocess.  */
       if (print_depth >= PRINT_CIRCLE)
 	error ("Apparently circular structure being printed");
 
-- 
2.19.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 1 Aug 2019 01:06:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 31 21:06:42 2019
Received: from localhost ([127.0.0.1]:53285 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hszYI-0006M2-Ba
	for submit <at> debbugs.gnu.org; Wed, 31 Jul 2019 21:06:42 -0400
Received: from aibo.runbox.com ([91.220.196.211]:41952)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gazally@HIDDEN>) id 1hszYG-0006Ls-EP
 for 36566 <at> debbugs.gnu.org; Wed, 31 Jul 2019 21:06:40 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; 
 s=rbselector1;
 h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From;
 bh=UT0sxeLtUx4ypZJme2hRgICg3XE7MydWj3Q0qAHPtM8=; b=HMywhtqYwlAv4bo/kG4ciud1ki
 PUsbQOwHVJH/4Bu812o/1jNAgi2MOcqY3m0mCJmx9ePD9bWZcjf+wlN5zyZtaEVDejP7oBCySqmHy
 JI97pDo/K3wBztWDjSSczhRJgcf5X7wL8SWh61ptqrpMguhwi42W8uofKIUCg34PuDmc6NUuL0LLK
 9Xpy8D35RzUCl2+hDWZbNbouVazZgp5g82i9qz91Gh87TK0Il1HYrHld25grV53w8Yy5OPllpg1DY
 5p1Ukkz7Sh2jZxdu5+wnUF5Ga7duGN3nQjdmsHiYjyagdPRF0tMokvQ+E/UCKDZ24DZtN1qHivCaC
 +MClyxUw==;
Received: from [10.9.9.202] (helo=mailfront20.runbox)
 by mailtransmit02.runbox with esmtp (Exim 4.86_2)
 (envelope-from <gazally@HIDDEN>)
 id 1hszYE-0008DP-Ro; Thu, 01 Aug 2019 03:06:38 +0200
Received: by mailfront20.runbox with esmtpsa (uid:179284 )
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1)
 id 1hszXp-0002mw-37; Thu, 01 Aug 2019 03:06:13 +0200
From: Gemini Lasswell <gazally@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
References: <87r26yvb4r.fsf@HIDDEN> <871ryy2l1t.fsf@HIDDEN>
 <87r26xjyon.fsf@HIDDEN> <877e8llbzo.fsf@HIDDEN>
 <87h87ogii4.fsf@HIDDEN>
Date: Wed, 31 Jul 2019 18:06:10 -0700
In-Reply-To: <87h87ogii4.fsf@HIDDEN> (Michael Heerdegen's message of "Mon, 15
 Jul 2019 04:05:07 +0200")
Message-ID: <87zhkt8zjx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36566
Cc: 36566 <at> debbugs.gnu.org, Noam Postavsky <npostavs@HIDDEN>
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 (-)

Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> BTW, when I eval this
>
> (let ((x '#1=(1 . #1#)))
>   (debug)
>   (cons x x))
>
> I get a backtrace like
>
> Debugger entered: nil
>   (let ((x '(1 . #6))) (debug) (cons x x))
>   eval((let ((x '(1 . #7))) (debug) (cons x x)) t)
>
> whereby when I hit C-u # all references get number 1, or start from 1
> for every frame:
>
> Debugger entered: nil
>   (let ((x '#1=(1 . #1#))) (debug) (cons x x))
>   eval((let ((x '#1=(1 . #1#))) (debug) (cons x x)) t)
>
> Just a minor inconvenience, though.

Without print-circle turned on, no hash table gets built to identify
objects, so the #<number> is only an indicator that a loop was found in
the data structure, not an indicator of any particular object. The
number printed comes from the depth of nested data structures at the
point the loop is detected.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 1 Aug 2019 01:05:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 31 21:05:10 2019
Received: from localhost ([127.0.0.1]:53279 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hszWn-0006Jj-UF
	for submit <at> debbugs.gnu.org; Wed, 31 Jul 2019 21:05:10 -0400
Received: from mail-io1-f43.google.com ([209.85.166.43]:45548)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1hszWm-0006JW-HZ
 for 36566 <at> debbugs.gnu.org; Wed, 31 Jul 2019 21:05:09 -0400
Received: by mail-io1-f43.google.com with SMTP id g20so140574522ioc.12
 for <36566 <at> debbugs.gnu.org>; Wed, 31 Jul 2019 18:05:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=D1U9aZopTh1KNQJvq2wxmPaJt84SqvtKOcG4VDZvqaE=;
 b=Mbt4UD65CKooT7EhjNqZcqvdjpmfTZYn5x1+LaiRd6SNLAXNFW0w48E1XcP0IfN08H
 3m4tYlmIS+R6Nen1htdXT1/iN/rb1fbp4+gI2GjXH5xMLnHPxBMEYfXG1X5yWRUa667a
 EkrPiPanXWHzQQsBGXnrEiLVjPqYNOsOh3JJ8kGGZalwmECNgg3yPpeNF+hVmd5MQsqq
 74TNHw53JzYrkd6GSpEY6hjhh5NIcaWvvFTjEdxFxhRAm2SUw7ovmxW6iLnrsKpuofgx
 6pTUjYdZ0l0MA4rp1vspoA+6QVJmiz0Nf1BsexLVhoGZEPJyB+i2WtNDAKIDC3I/RyGn
 r9/g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=D1U9aZopTh1KNQJvq2wxmPaJt84SqvtKOcG4VDZvqaE=;
 b=XxTM2CK7HwekcTQ9c67dQvGlZhIi/ULc1UuFuA5KTVBM6jCatbvydNjEFAjiNU+djI
 kAtqfpCVcQL7S0RgjqXCHoqalwUwiPpZV9zAuG9G6PbkJd1mGJbXIyJ2MMOBP/DUrfiR
 ceHr0n+iGjuqYFW02G/4lBpQzIweFCpYEhis0oZWjfO4bZaVN32aX7Up05YsorCr3dt9
 j6biaMr8xHYS8CCxcAgA/tBT8CryRZwlN+tGk0d26Zbdi8BY/iUh1YtKyx1tYC5p53nN
 u33taNn5bfV4MnyrtrN6GRV14pwKPYsFKFtn1Cq5UUyFYtBVaL/oKBY50rZgzEp6+PIT
 vqyw==
X-Gm-Message-State: APjAAAU9LWng1eMINkyqe3ZnQuuF6QjDEbPyry0nPD/ulN9ZpCvfD4IZ
 0xCu+vOKoFd3F6P7LgnOxM4=
X-Google-Smtp-Source: APXvYqx4BHmbm1hk8FtymTVau68htrMfCqiIv4RsONuMYR2J0hVISecYYSgktVbjlkE/fJ2808rZ+w==
X-Received: by 2002:a5d:8a06:: with SMTP id w6mr26889819iod.267.1564621503065; 
 Wed, 31 Jul 2019 18:05:03 -0700 (PDT)
Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.gmail.com with ESMTPSA id
 m25sm40470555ion.35.2019.07.31.18.05.01
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 31 Jul 2019 18:05:02 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: Gemini Lasswell <gazally@HIDDEN>
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
References: <87r26yvb4r.fsf@HIDDEN> <871ryy2l1t.fsf@HIDDEN>
 <87r26xjyon.fsf@HIDDEN> <877e8llbzo.fsf@HIDDEN>
 <8736ilaepu.fsf@HIDDEN>
Date: Wed, 31 Jul 2019 21:05:01 -0400
In-Reply-To: <8736ilaepu.fsf@HIDDEN> (Gemini Lasswell's message of "Wed,
 31 Jul 2019 17:53:17 -0700")
Message-ID: <87h871u24i.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36566
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 36566 <at> debbugs.gnu.org,
 Stefan Monnier <monnier@HIDDEN>
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 (-)

Gemini Lasswell <gazally@HIDDEN> writes:

> The third patch attached below fixes that by adding a macro to
> cl-print.el to wrap the printing of all the simple things with
> let-bindings of print-circle and print-gensym to nil.

> Patch #3 has the advantage of being straightforward logically and not
> breaking anything which doesn't use cl-prin1, but it undoubtedly also
> slows down cl-prin1 in the probably more common case that print-gensym
> and print-circle are both nil.  There are other ways to fix this, such
> as by adding a new entry point in print.c for printing simple strings,
> or by modifying the logic in print_preprocess to not create a hash table
> if the top-level object is a string with no properties.

This last idea sounds like a straightforward win to me, with no obvious
drawbacks.  I mean, no point in allocating a hash table if we can
cheaply detect it will never be used, right?





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 1 Aug 2019 00:53:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 31 20:53:32 2019
Received: from localhost ([127.0.0.1]:53274 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hszLX-00061b-0V
	for submit <at> debbugs.gnu.org; Wed, 31 Jul 2019 20:53:31 -0400
Received: from aibo.runbox.com ([91.220.196.211]:41524)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gazally@HIDDEN>) id 1hszLU-00061R-4H
 for 36566 <at> debbugs.gnu.org; Wed, 31 Jul 2019 20:53:30 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; 
 s=rbselector1;
 h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From;
 bh=IKFzHN4ZYchAvAwryfuRm5h7/USBC+RXZm3VrMVp3dU=; b=Mw+dK7xfYtDYrQgVosyTU2IdCy
 qXYADT0H9yfvll3dGU8bcWz8fcycCaYWalqT132Z9UkZAigTDK4BKCG5lzgZXc2Ex8W0ekzYFL4Rj
 7lfYba20uZFfv8LuqEXWnOFnYzrdiXRhFwMCnDQlBFJ8EcjR3MVDSA9fC0AOjeUxaqBVuS0Hyt0eQ
 2/MeWTwLsrRuOx/KLRYMXtMBDd9TjQvJazrxEB8A0zaO5IpBLwqrcbM/XE2arvKSQGV7WNkAq485Z
 7d/BFZ+nOUjlVYtFIjK03Wi9BF9ffwGS8etQKNZCDP+UTbtCkDUJwRild18o91B87xSPnpGtxJGdd
 xIqfN4Zw==;
Received: from [10.9.9.202] (helo=mailfront20.runbox)
 by mailtransmit02.runbox with esmtp (Exim 4.86_2)
 (envelope-from <gazally@HIDDEN>)
 id 1hszLP-0007Be-7z; Thu, 01 Aug 2019 02:53:23 +0200
Received: by mailfront20.runbox with esmtpsa (uid:179284 )
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1)
 id 1hszLM-0004iY-CP; Thu, 01 Aug 2019 02:53:21 +0200
From: Gemini Lasswell <gazally@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
References: <87r26yvb4r.fsf@HIDDEN> <871ryy2l1t.fsf@HIDDEN>
 <87r26xjyon.fsf@HIDDEN> <877e8llbzo.fsf@HIDDEN>
Date: Wed, 31 Jul 2019 17:53:17 -0700
In-Reply-To: <877e8llbzo.fsf@HIDDEN> (Gemini Lasswell's message of "Sat,
 13 Jul 2019 17:02:19 -0700")
Message-ID: <8736ilaepu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36566
Cc: 36566 <at> debbugs.gnu.org, Noam Postavsky <npostavs@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
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 (-)

--=-=-=
Content-Type: text/plain

Gemini Lasswell <gazally@HIDDEN> writes:

> The reason master is so much slower than Emacs 26 is because of the
> adaptive abbreviating I added to reduce problems with really long lines.

That statement turned out to be true, however once I improved the
adaptive abbreviating algorithm it became apparent to me that backtrace
printing was creating an excessive amount of garbage in both Emacs 26
and 27 when either print-circle or print-gensym was set.

As part of my investigating process I made a patch which added a
hash-tables-consed variable along the lines of strings-consed et al,
which I incremented in Fmake_hash_table to count the number of hash
tables created, and got the following interesting result:

(let ((print-gensym t))
  (list hash-tables-consed (princ "hello") hash-tables-consed))
=>
hello
(814064 "hello" 814065)

This is relevant to backtrace printing because backtrace printing uses
cl-prin1, which prints Lisp data structures using

(princ "(" stream)

to print the parentheses, which was making for a lot of created and
destroyed hash tables whenever print-circle or print-gensym was set.

The third patch attached below fixes that by adding a macro to
cl-print.el to wrap the printing of all the simple things with
let-bindings of print-circle and print-gensym to nil.

Patch #2 improves cl-print-to-string-with-limit's adaptive fitting of a
printed representation into a given line length by making it reduce
print-level and print-length more rapidly when the result of a test
printing is very long.

Patch #1 improves the backtrace-mode UI by adding a command to toggle
print-gensym, and puts both that and its print-circle toggle command on
the menu, and adds an echo area message to both to let you know what
they did.

Here's how long Michael's use case takes to render the backtrace
buffer on my machine, with print-gensym non-nil, in various versions of
Emacs:

Emacs 26.2: 4.1s
Emacs 27, before patches: 9.4s
Emacs 27, with patch #2: 5.6s
Emacs 27, with patches #2 and #3: 1.2s.

Patch #3 has the advantage of being straightforward logically and not
breaking anything which doesn't use cl-prin1, but it undoubtedly also
slows down cl-prin1 in the probably more common case that print-gensym
and print-circle are both nil.  There are other ways to fix this, such
as by adding a new entry point in print.c for printing simple strings,
or by modifying the logic in print_preprocess to not create a hash table
if the top-level object is a string with no properties.  I'm not sure
what the best choice is here, so let me know what you think.


--=-=-=
Content-Type: text/plain
Content-Disposition: attachment;
 filename=0001-Improve-print-output-options-commands-in-backtrace-m.patch
Content-Description: Patch #1

From 12c28d02ee7dc34133f5cd1352d6d65f86509bb7 Mon Sep 17 00:00:00 2001
From: Gemini Lasswell <gazally@HIDDEN>
Date: Tue, 30 Jul 2019 10:00:27 -0700
Subject: [PATCH 1/3] Improve print output options commands in backtrace-mode
 (bug#36566)

* lisp/emacs-lisp/backtrace.el (backtrace-view): Mention
:print-gensym in docstring.
(backtrace-mode-map): Add keyboard binding for
backtrace-toggle-print-gensym.  Add menu entries for
backtrace-toggle-print-circle and backtrace-toggle-print-gensym.
(backtrace--with-output-variables): Bind print-gensym with value
of :print-gensym found in view plist.
(backtrace-toggle-print-circle): Remove description of
implementation details from docstring.
(backtrace-toggle-print-gensym): New command.
(backtrace--toggle-feature): Add echo area message describing result
of command.

* test/lisp/emacs-lisp/backtrace-tests.el
(backtrace-tests--print-circle): New test.

* doc/lispref/debugging.texi (Backtraces): Document keyboard
binding for backtrace-toggle-print-gensym.
---
 doc/lispref/debugging.texi              |  3 ++
 lisp/emacs-lisp/backtrace.el            | 44 +++++++++++++++++-----
 test/lisp/emacs-lisp/backtrace-tests.el | 49 +++++++++++++++++++++++++
 3 files changed, 86 insertions(+), 10 deletions(-)

diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index 9e43343310..5393b2766a 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -457,6 +457,9 @@ Backtraces
 @item #
 Toggle @code{print-circle} for the frame at point.
 
+@item :
+Toggle @code{print-gensym} for the frame at point.
+
 @item .
 Expand all the forms abbreviated with ``...'' in the frame at point.
 
diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el
index 60d146e24a..0c4c7987c3 100644
--- a/lisp/emacs-lisp/backtrace.el
+++ b/lisp/emacs-lisp/backtrace.el
@@ -175,7 +175,8 @@ backtrace-frames
 
 (defvar-local backtrace-view nil
   "A plist describing how to render backtrace frames.
-Possible entries are :show-flags, :show-locals and :print-circle.")
+Possible entries are :show-flags, :show-locals, :print-circle
+and :print-gensym.")
 
 (defvar-local backtrace-insert-header-function nil
   "Function for inserting a header for the current Backtrace buffer.
@@ -205,6 +206,7 @@ backtrace-mode-map
     (define-key map "p" 'backtrace-backward-frame)
     (define-key map "v" 'backtrace-toggle-locals)
     (define-key map "#" 'backtrace-toggle-print-circle)
+    (define-key map ":" 'backtrace-toggle-print-gensym)
     (define-key map "s" 'backtrace-goto-source)
     (define-key map "\C-m" 'backtrace-help-follow-symbol)
     (define-key map "+" 'backtrace-multi-line)
@@ -224,6 +226,18 @@ backtrace-mode-map
          :active (backtrace-get-index)
          :selected (plist-get (backtrace-get-view) :show-locals)
          :help "Show or hide the local variables for the frame at point"]
+        ["Show Circular Structures" backtrace-toggle-print-circle
+         :style toggle
+         :active (backtrace-get-index)
+         :selected (plist-get (backtrace-get-view) :print-circle)
+         :help
+         "Condense or expand shared or circular structures in the frame at point"]
+        ["Show Uninterned Symbols" backtrace-toggle-print-gensym
+         :style toggle
+         :active (backtrace-get-index)
+         :selected (plist-get (backtrace-get-view) :print-gensym)
+         :help
+         "Toggle unique printing of uninterned symbols in the frame at point"]
         ["Expand \"...\"s" backtrace-expand-ellipses
          :help "Expand all the abbreviated forms in the current frame"]
         ["Show on Multiple Lines" backtrace-multi-line
@@ -339,6 +353,7 @@ backtrace--with-output-variables
   `(let ((print-escape-control-characters t)
          (print-escape-newlines t)
          (print-circle (plist-get ,view :print-circle))
+         (print-gensym (plist-get ,view :print-gensym))
          (standard-output (current-buffer)))
      ,@body))
 
@@ -420,12 +435,18 @@ backtrace--change-button-skip
 
 (defun backtrace-toggle-print-circle (&optional all)
   "Toggle `print-circle' for the backtrace frame at point.
-With prefix argument ALL, toggle the value of :print-circle in
-`backtrace-view', which affects all of the backtrace frames in
-the buffer."
+With prefix argument ALL, toggle the default value bound to
+`print-circle' for all the frames in the buffer."
   (interactive "P")
   (backtrace--toggle-feature :print-circle all))
 
+(defun backtrace-toggle-print-gensym (&optional all)
+  "Toggle `print-gensym' for the backtrace frame at point.
+With prefix argument ALL, toggle the default value bound to
+`print-gensym' for all the frames in the buffer."
+  (interactive "P")
+  (backtrace--toggle-feature :print-gensym all))
+
 (defun backtrace--toggle-feature (feature all)
   "Toggle FEATURE for the current backtrace frame or for the buffer.
 FEATURE should be one of the options in `backtrace-view'.  If ALL
@@ -450,12 +471,15 @@ backtrace--toggle-feature
           (goto-char (point-min))
           (while (and (not (eql index (backtrace-get-index)))
                       (< (point) (point-max)))
-            (goto-char (backtrace-get-frame-end)))))
-    (let ((index (backtrace-get-index)))
-      (unless index
-        (user-error "Not in a stack frame"))
-      (backtrace--set-feature feature
-                              (not (plist-get (backtrace-get-view) feature))))))
+            (goto-char (backtrace-get-frame-end))))
+        (message "%s is now %s for all frames"
+                 (substring (symbol-name feature) 1) value))
+    (unless (backtrace-get-index)
+      (user-error "Not in a stack frame"))
+    (let ((value (not (plist-get (backtrace-get-view) feature))))
+      (backtrace--set-feature feature value)
+      (message "%s is now %s for this frame"
+               (substring (symbol-name feature) 1) value))))
 
 (defun backtrace--set-feature (feature value)
   "Set FEATURE in the view plist of the frame at point to VALUE.
diff --git a/test/lisp/emacs-lisp/backtrace-tests.el b/test/lisp/emacs-lisp/backtrace-tests.el
index ce827e0166..be15495342 100644
--- a/test/lisp/emacs-lisp/backtrace-tests.el
+++ b/test/lisp/emacs-lisp/backtrace-tests.el
@@ -335,6 +335,55 @@ backtrace-tests--print-circle
       (should (string-match-p results
                               (backtrace-tests--get-substring (point-min) (point-max)))))))
 
+(ert-deftest backtrace-tests--print-gensym ()
+  "Backtrace buffers can toggle `print-gensym' syntax."
+  (ert-with-test-buffer (:name "print-gensym")
+    (let* ((print-gensym nil)
+           (arg (list (gensym "first") (gensym) (gensym "last")))
+           (results (backtrace-tests--make-regexp
+                     (backtrace-tests--result arg)))
+           (results-gensym (regexp-quote (let ((print-gensym t))
+                                           (backtrace-tests--result arg))))
+           (last-frame (backtrace-tests--make-regexp
+                        (format (nth (1- backtrace-tests--line-count)
+                                     (backtrace-tests--backtrace-lines))
+                                arg)))
+           (last-frame-gensym (regexp-quote
+                               (let ((print-gensym t))
+                                 (format (nth (1- backtrace-tests--line-count)
+                                              (backtrace-tests--backtrace-lines))
+                                         arg)))))
+      (backtrace-tests--make-backtrace arg)
+      (backtrace-print)
+      (should (string-match-p results
+                              (backtrace-tests--get-substring (point-min) (point-max))))
+      ;; Go to the last frame.
+      (goto-char (point-max))
+      (forward-line -1)
+      ;; Turn on print-gensym for that frame.
+      (backtrace-toggle-print-gensym)
+      (should (string-match-p last-frame-gensym
+                              (backtrace-tests--get-substring (point) (point-max))))
+      ;; Turn off print-gensym for the frame.
+      (backtrace-toggle-print-gensym)
+      (should (string-match-p last-frame
+                              (backtrace-tests--get-substring (point) (point-max))))
+      (should (string-match-p results
+                              (backtrace-tests--get-substring (point-min) (point-max))))
+      ;; Turn print-gensym on for the buffer.
+      (backtrace-toggle-print-gensym '(4))
+      (should (string-match-p last-frame-gensym
+                              (backtrace-tests--get-substring (point) (point-max))))
+      (should (string-match-p results-gensym
+                              (backtrace-tests--get-substring (point-min) (point-max))))
+      ;; Turn print-gensym off.
+      (backtrace-toggle-print-gensym '(4))
+      (should (string-match-p last-frame
+                              (backtrace-tests--get-substring
+                               (point) (+ (point) (length last-frame)))))
+      (should (string-match-p results
+                              (backtrace-tests--get-substring (point-min) (point-max)))))))
+
 (defun backtrace-tests--make-regexp (str)
   "Make regexp from STR for `backtrace-tests--print-circle'.
 Used for results of printing circular objects without
-- 
2.19.2


--=-=-=
Content-Type: text/plain
Content-Disposition: attachment;
 filename=0002-Improve-performance-of-backtrace-printing-bug-36566.patch
Content-Description: Patch #2

From d1bc53f6e803336b279694c529bcaddd2bbb688f Mon Sep 17 00:00:00 2001
From: Gemini Lasswell <gazally@HIDDEN>
Date: Tue, 30 Jul 2019 11:56:51 -0700
Subject: [PATCH 2/3] Improve performance of backtrace printing (bug#36566)

* lisp/emacs-lisp/cl-print.el (cl-print-to-string-with-limit): Reduce
print-level and print-length more quickly when the structure being
printed is very large.
---
 lisp/emacs-lisp/cl-print.el | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/lisp/emacs-lisp/cl-print.el b/lisp/emacs-lisp/cl-print.el
index 5fe3dd1b91..530770128e 100644
--- a/lisp/emacs-lisp/cl-print.el
+++ b/lisp/emacs-lisp/cl-print.el
@@ -548,21 +548,22 @@ cl-print-to-string-with-limit
   ;; call_debugger (bug#31919).
   (let* ((print-length (when limit (min limit 50)))
          (print-level (when limit (min 8 (truncate (log limit)))))
-         (delta (when limit
-                  (max 1 (truncate (/ print-length print-level))))))
+         (delta-length (when limit
+                         (max 1 (truncate (/ print-length print-level))))))
     (with-temp-buffer
       (catch 'done
         (while t
           (erase-buffer)
           (funcall print-function value (current-buffer))
-          ;; Stop when either print-level is too low or the value is
-          ;; successfully printed in the space allowed.
-          (when (or (not limit)
-                    (< (- (point-max) (point-min)) limit)
-                    (= print-level 2))
-            (throw 'done (buffer-string)))
-          (cl-decf print-level)
-          (cl-decf print-length delta))))))
+          (let ((result (- (point-max) (point-min))))
+            ;; Stop when either print-level is too low or the value is
+            ;; successfully printed in the space allowed.
+            (when (or (not limit) (< result limit) (<= print-level 2))
+              (throw 'done (buffer-string)))
+            (let* ((ratio (/ result limit))
+                   (delta-level (max 1 (min (- print-level 2) ratio))))
+              (cl-decf print-level delta-level)
+              (cl-decf print-length (* delta-length delta-level)))))))))
 
 (provide 'cl-print)
 ;;; cl-print.el ends here
-- 
2.19.2


--=-=-=
Content-Type: text/plain
Content-Disposition: attachment;
 filename=0003-Fix-excessive-hash-table-creation-in-cl-prin1-bug-36.patch
Content-Description: Patch #3

From 5e62789a1b0c24560565312e220e0122d2f03ea3 Mon Sep 17 00:00:00 2001
From: Gemini Lasswell <gazally@HIDDEN>
Date: Wed, 31 Jul 2019 16:07:24 -0700
Subject: [PATCH 3/3] Fix excessive hash table creation in cl-prin1 (bug
 #36566)

Bind print-circle and print-gensym to nil when printing
simple objects, to prevent princ from creating unnecessary
hash tables.

* lisp/emacs-lisp/cl-print.el (cl--princ): New macro.
(cl-print-object, cl-print-object-contents): Use it.
---
 lisp/emacs-lisp/cl-print.el | 132 +++++++++++++++++++-----------------
 1 file changed, 70 insertions(+), 62 deletions(-)

diff --git a/lisp/emacs-lisp/cl-print.el b/lisp/emacs-lisp/cl-print.el
index 530770128e..aa9364e282 100644
--- a/lisp/emacs-lisp/cl-print.el
+++ b/lisp/emacs-lisp/cl-print.el
@@ -44,6 +44,14 @@ cl-print--depth
   "Depth of recursion within cl-print functions.
 Compared to `print-level' to determine when to stop recursing.")
 
+(defmacro cl--princ (obj &optional stream)
+  "Print a simple OBJ to STREAM.
+Bind `print-gensym' and `print-circle' to nil so that `princ'
+won't create a hash table (bug#36566)."
+  (declare (debug t))
+  `(let ((print-circle nil)
+         (print-gensym nil))
+     (princ ,obj ,stream)))
 
 ;;;###autoload
 (cl-defgeneric cl-print-object (object stream)
@@ -75,13 +83,13 @@ cl-print-object
                (consp object)
                (null (cdr object)))
           (progn
-            (princ (cond
+            (cl--princ (cond
                     ((eq car 'quote) '\')
                     ((eq car 'function) "#'")
                     (t car))
                    stream)
             (cl-print-object (car object) stream))
-        (princ "(" stream)
+        (cl--princ "(" stream)
         (cl-print-object car stream)
         (while (and (consp object)
                     (not (cond
@@ -90,15 +98,15 @@ cl-print-object
                           ((memq object cl-print--currently-printing))
                           (t (push object cl-print--currently-printing)
                              nil))))
-          (princ " " stream)
+          (cl--princ " " stream)
           (if (or (not (natnump print-length)) (> print-length count))
               (cl-print-object (pop object) stream)
             (cl-print-insert-ellipsis object print-length stream)
             (setq object nil))
           (cl-incf count))
         (when object
-          (princ " . " stream) (cl-print-object object stream))
-        (princ ")" stream)))))
+          (cl--princ " . " stream) (cl-print-object object stream))
+        (cl--princ ")" stream)))))
 
 (cl-defmethod cl-print-object-contents ((object cons) _start stream)
   (let ((count 0))
@@ -110,30 +118,30 @@ cl-print-object-contents
                       (t (push object cl-print--currently-printing)
                          nil))))
       (unless (zerop count)
-        (princ " " stream))
+        (cl--princ " " stream))
       (if (or (not (natnump print-length)) (> print-length count))
           (cl-print-object (pop object) stream)
         (cl-print-insert-ellipsis object print-length stream)
         (setq object nil))
       (cl-incf count))
     (when object
-      (princ " . " stream) (cl-print-object object stream))))
+      (cl--princ " . " stream) (cl-print-object object stream))))
 
 (cl-defmethod cl-print-object ((object vector) stream)
   (if (and cl-print--depth (natnump print-level)
            (> cl-print--depth print-level))
       (cl-print-insert-ellipsis object 0 stream)
-    (princ "[" stream)
+    (cl--princ "[" stream)
     (let* ((len (length object))
            (limit (if (natnump print-length)
                       (min print-length len) len)))
       (dotimes (i limit)
-        (unless (zerop i) (princ " " stream))
+        (unless (zerop i) (cl--princ " " stream))
         (cl-print-object (aref object i) stream))
       (when (< limit len)
-        (princ " " stream)
+        (cl--princ " " stream)
         (cl-print-insert-ellipsis object limit stream)))
-    (princ "]" stream)))
+    (cl--princ "]" stream)))
 
 (cl-defmethod cl-print-object-contents ((object vector) start stream)
   (let* ((len (length object))
@@ -141,22 +149,22 @@ cl-print-object-contents
                     (min (+ start print-length) len) len))
          (i start))
     (while (< i limit)
-      (unless (= i start) (princ " " stream))
+      (unless (= i start) (cl--princ " " stream))
       (cl-print-object (aref object i) stream)
       (cl-incf i))
     (when (< limit len)
-      (princ " " stream)
+      (cl--princ " " stream)
       (cl-print-insert-ellipsis object limit stream))))
 
 (cl-defmethod cl-print-object ((object hash-table) stream)
-  (princ "#<hash-table " stream)
+  (cl--princ "#<hash-table " stream)
   (princ (hash-table-test object) stream)
-  (princ " " stream)
-  (princ (hash-table-count object) stream)
-  (princ "/" stream)
-  (princ (hash-table-size object) stream)
-  (princ (format " %#x" (sxhash object)) stream)
-  (princ ">" stream))
+  (cl--princ " " stream)
+  (cl--princ (hash-table-count object) stream)
+  (cl--princ "/" stream)
+  (cl--princ (hash-table-size object) stream)
+  (cl--princ (format " %#x" (sxhash object)) stream)
+  (cl--princ ">" stream))
 
 (define-button-type 'help-byte-code
   'follow-link t
@@ -181,19 +189,19 @@ cl-print-compiled-button
 (cl-defmethod cl-print-object ((object compiled-function) stream)
   (unless stream (setq stream standard-output))
   ;; We use "#f(...)" rather than "#<...>" so that pp.el gives better results.
-  (princ "#f(compiled-function " stream)
+  (cl--princ "#f(compiled-function " stream)
   (let ((args (help-function-arglist object 'preserve-names)))
     (if args
         (prin1 args stream)
-      (princ "()" stream)))
+      (cl--princ "()" stream)))
   (pcase (help-split-fundoc (documentation object 'raw) object)
     ;; Drop args which `help-function-arglist' already printed.
     (`(,_usage . ,(and doc (guard (stringp doc))))
-     (princ " " stream)
+     (cl--princ " " stream)
      (prin1 doc stream)))
   (let ((inter (interactive-form object)))
     (when inter
-      (princ " " stream)
+      (cl--princ " " stream)
       (cl-print-object
        (if (eq 'byte-code (car-safe (cadr inter)))
            `(interactive ,(make-byte-code nil (nth 1 (cadr inter))
@@ -202,26 +210,26 @@ cl-print-object
          inter)
        stream)))
   (if (eq cl-print-compiled 'disassemble)
-      (princ
+      (cl--princ
        (with-temp-buffer
          (insert "\n")
          (disassemble-1 object 0)
          (buffer-string))
        stream)
-    (princ " " stream)
+    (cl--princ " " stream)
     (let ((button-start (and cl-print-compiled-button
                              (bufferp stream)
                              (with-current-buffer stream (point)))))
-      (princ (format "#<bytecode %#x>" (sxhash object)) stream)
+      (cl--princ (format "#<bytecode %#x>" (sxhash object)) stream)
       (when (eq cl-print-compiled 'static)
-        (princ " " stream)
+        (cl--princ " " stream)
         (cl-print-object (aref object 2) stream))
       (when button-start
         (with-current-buffer stream
           (make-text-button button-start (point)
                             :type 'help-byte-code
                             'byte-code-function object)))))
-  (princ ")" stream))
+  (cl--princ ")" stream))
 
 ;; This belongs in nadvice.el, of course, but some load-ordering issues make it
 ;; complicated: cl-generic uses macros from cl-macs and cl-macs uses advice-add
@@ -231,24 +239,24 @@ cl-print-object
               ((object compiled-function) stream)
   (if (not (advice--p object))
       (cl-call-next-method)
-    (princ "#f(advice-wrapper " stream)
+    (cl--princ "#f(advice-wrapper " stream)
     (when (fboundp 'advice--where)
-      (princ (advice--where object) stream)
-      (princ " " stream))
+      (cl--princ (advice--where object) stream)
+      (cl--princ " " stream))
     (cl-print-object (advice--cdr object) stream)
-    (princ " " stream)
+    (cl--princ " " stream)
     (cl-print-object (advice--car object) stream)
     (let ((props (advice--props object)))
       (when props
-        (princ " " stream)
+        (cl--princ " " stream)
         (cl-print-object props stream)))
-    (princ ")" stream)))
+    (cl--princ ")" stream)))
 
 (cl-defmethod cl-print-object ((object cl-structure-object) stream)
   (if (and cl-print--depth (natnump print-level)
            (> cl-print--depth print-level))
       (cl-print-insert-ellipsis object 0 stream)
-    (princ "#s(" stream)
+    (cl--princ "#s(" stream)
     (let* ((class (cl-find-class (type-of object)))
            (slots (cl--struct-class-slots class))
            (len (length slots))
@@ -257,14 +265,14 @@ cl-print-object
       (princ (cl--struct-class-name class) stream)
       (dotimes (i limit)
         (let ((slot (aref slots i)))
-          (princ " :" stream)
+          (cl--princ " :" stream)
           (princ (cl--slot-descriptor-name slot) stream)
-          (princ " " stream)
+          (cl--princ " " stream)
           (cl-print-object (aref object (1+ i)) stream)))
       (when (< limit len)
-        (princ " " stream)
+        (cl--princ " " stream)
         (cl-print-insert-ellipsis object limit stream)))
-    (princ ")" stream)))
+    (cl--princ ")" stream)))
 
 (cl-defmethod cl-print-object-contents ((object cl-structure-object) start stream)
   (let* ((class (cl-find-class (type-of object)))
@@ -275,14 +283,14 @@ cl-print-object-contents
          (i start))
     (while (< i limit)
       (let ((slot (aref slots i)))
-        (unless (= i start) (princ " " stream))
-        (princ ":" stream)
-        (princ (cl--slot-descriptor-name slot) stream)
-        (princ " " stream)
+        (unless (= i start) (cl--princ " " stream))
+        (cl--princ ":" stream)
+        (cl--princ (cl--slot-descriptor-name slot) stream)
+        (cl--princ " " stream)
         (cl-print-object (aref object (1+ i)) stream))
       (cl-incf i))
     (when (< limit len)
-      (princ " " stream)
+      (cl--princ " " stream)
       (cl-print-insert-ellipsis object limit stream))))
 
 (cl-defmethod cl-print-object ((object string) stream)
@@ -298,7 +306,7 @@ cl-print-object
         (cl-print-insert-ellipsis object 0 stream)
       ;; Print all or part of the string
       (when has-properties
-        (princ "#(" stream))
+        (cl--princ "#(" stream))
       (if (= limit len)
           (prin1 (if has-properties (substring-no-properties object) object)
                  stream)
@@ -322,16 +330,16 @@ cl-print-object
                       (< start-pos len))
             (let ((props (text-properties-at start-pos object)))
               (when props
-                (princ " " stream) (princ start-pos stream)
-                (princ " " stream) (princ end-pos stream)
-                (princ " " stream) (cl-print-object props stream)
+                (cl--princ " " stream) (cl--princ start-pos stream)
+                (cl--princ " " stream) (cl--princ end-pos stream)
+                (cl--princ " " stream) (cl-print-object props stream)
                 (cl-incf interval-count))
               (setq start-pos end-pos
                     end-pos (next-property-change start-pos object len))))
           (when (< start-pos len)
-            (princ " " stream)
+            (cl--princ " " stream)
             (cl-print-insert-ellipsis object (list start-pos) stream)))
-        (princ ")" stream)))))
+        (cl--princ ")" stream)))))
 
 (cl-defmethod cl-print-object-contents ((object string) start stream)
   ;; If START is an integer, it is an index into the string, and the
@@ -346,7 +354,7 @@ cl-print-object-contents
                (substr (substring-no-properties object start limit))
                (printed (prin1-to-string substr))
                (trimmed (substring printed 1 (1- (length printed)))))
-          (princ trimmed)
+          (cl--princ trimmed stream)
           (when (< limit len)
             (cl-print-insert-ellipsis object limit stream)))
 
@@ -364,15 +372,15 @@ cl-print-object-contents
             (when props
               (if first
                   (setq first nil)
-                (princ " " stream))
-              (princ start-pos stream)
-              (princ " " stream) (princ end-pos stream)
-              (princ " " stream) (cl-print-object props stream)
+                (cl--princ " " stream))
+              (cl--princ start-pos stream)
+              (cl--princ " " stream) (cl--princ end-pos stream)
+              (cl--princ " " stream) (cl-print-object props stream)
               (cl-incf interval-count))
             (setq start-pos end-pos
                   end-pos (next-property-change start-pos object len))))
         (when (< start-pos len)
-          (princ " " stream)
+          (cl--princ " " stream)
           (cl-print-insert-ellipsis object (list start-pos) stream))))))
 
 ;;; Circularity and sharing.
@@ -391,16 +399,16 @@ cl-print-object
             (cl-call-next-method)
           (if (> n 0)
               ;; Already printed.  Just print a reference.
-              (progn (princ "#" stream) (princ n stream) (princ "#" stream))
+              (progn (cl--princ "#" stream) (cl--princ n stream) (cl--princ "#" stream))
             (puthash object (- n) cl-print--number-table)
-            (princ "#" stream) (princ (- n) stream) (princ "=" stream)
+            (cl--princ "#" stream) (cl--princ (- n) stream) (cl--princ "=" stream)
             (cl-call-next-method)))))
      ((let ((already-printing (memq object cl-print--currently-printing)))
         (when already-printing
           ;; Currently printing, just print reference to avoid endless
           ;; recursion.
-          (princ "#" stream)
-          (princ (length (cdr already-printing)) stream))))
+          (cl--princ "#" stream)
+          (cl--princ (length (cdr already-printing)) stream))))
      (t (let ((cl-print--currently-printing
                (cons object cl-print--currently-printing)))
           (cl-call-next-method))))))
@@ -470,7 +478,7 @@ cl-print-insert-ellipsis
   (unless stream (setq stream standard-output))
   (let ((ellipsis-start (and (bufferp stream)
                              (with-current-buffer stream (point)))))
-    (princ "..." stream)
+    (cl--princ "..." stream)
     (when ellipsis-start
       (with-current-buffer stream
         (cl-print-propertize-ellipsis object start ellipsis-start (point)
-- 
2.19.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 15 Jul 2019 02:05:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 14 22:05:23 2019
Received: from localhost ([127.0.0.1]:46215 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hmqMl-00072E-J1
	for submit <at> debbugs.gnu.org; Sun, 14 Jul 2019 22:05:23 -0400
Received: from mout.web.de ([212.227.15.4]:52137)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1hmqMi-00071z-7I
 for 36566 <at> debbugs.gnu.org; Sun, 14 Jul 2019 22:05:21 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de;
 s=dbaedf251592; t=1563156309;
 bh=N7Qt4+7z/NV5g9iNhR6YkytLQkW32i1Ul4ds+7rDa10=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=pktMV4qz7lY+2vUj3NI1uN7hdu2Tsku88q0iImi5i5JJX6yJNvYSSrkTqAihgie5H
 UN+julQDaxa15NnjrKxSYGfK6+s5o9EEwOysunKPM4Wc1fHfOUY3U41D8sfTPEOocf
 N6NqEl8DocZvkOe53hv26Y2ajLz0XiaEhxBedRXo=
X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9
Received: from drachen.dragon ([92.208.178.213]) by smtp.web.de (mrweb002
 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MRTzc-1htOrl2vdY-00Sfoc; Mon, 15
 Jul 2019 04:05:09 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Gemini Lasswell <gazally@HIDDEN>
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
References: <87r26yvb4r.fsf@HIDDEN> <871ryy2l1t.fsf@HIDDEN>
 <87r26xjyon.fsf@HIDDEN> <877e8llbzo.fsf@HIDDEN>
Date: Mon, 15 Jul 2019 04:05:07 +0200
In-Reply-To: <877e8llbzo.fsf@HIDDEN> (Gemini Lasswell's message of "Sat,
 13 Jul 2019 17:02:19 -0700")
Message-ID: <87h87ogii4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:kM6jGEJ5ERuH60LIsTJBqINKsXsCxaH3+jQo5f7ELpa6wECvRiL
 cJX/YAafQU9GQLeKxEZtAKGY5dr0qqERGp3jvC/tNxEBHV6TEpZP7JwN/EvZyu2lKjQJcPc
 /CLlmrIlnxM/netFQHtYAPOreYKbwooULJVtQ9A6OgC2A0jKfqsnbVPPmYqR7pD9dbsgcze
 pCaQLgc4mAbnr41+EqmrA==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:qneAhh1vZ4I=:Ns8TEAnQKkufoKwvRlQP5g
 UuOiPM4gko1tWXASJDWCAO9rOF+TqjMO0MOklG2NzDxFcwhD2qdJJZF14kya/n2X71KFwyI4K
 PuS1p/L8k1Ow0EvDhyB8Byn2V7foMaDY83KtLBA2DTtJv1cykz80qXZYwuHbqOTX6v2trMQPC
 HFKFpJRthI8Sw0XWhi6+ZPC/pdv+f4XZewaq0Su9N5cu1282OV6owScMHYWmgzlD2rKSkF0q2
 3ktZup0Jz7lGMaP50bJJsLjGv1IguadDuHvpSL5F02rniC34roLP/MwySV9XBeT3LijaLaL9M
 b9NEDQodi8CNVX0Pdvc70+WzmrdgwwV91MfN3YX5FHyEuWNZTtnfzkhTjxeEOili9N1hZJfCh
 Qd6tvoNH88oqm3F6ey4bvaSS6KfSO2qLbjhj5qCw3SLQY3MyFPNYJy8yk+kDwCggQIHM/oCEq
 7LAclobgGpYoh1XdeXIMLw+/LCwggmCiAvRadNTmhXsXE/hLLn5vVeLToT0IamCrCR4rzxKKW
 hl8klA7lSJ76tBzX4Sw6xiGXHnfY9Lctmz6fnuPpOZPYigBqsyiQodQWXFUwJga+GUo2G9FL7
 o7diXj0VyWP+1sud9Ag0JZNXrVt8OLWnWMNEI9JViGM9tIdTMLKYjIv7fJqObzSecSMfv4WIX
 NqpkR6gw0tMM0bEeUxASipKxugkyZUXkLEaIM+Ep3WB34nXbknhH7vHAnkOaR4cDZxi/AjM8m
 xvhoDZHXz2zlVOZJmn1x3xNMSqpXId6g6XIRH/1hv3SmYmADrHWyDpaKhhgwnCfDE4u7EeKIm
 MjVFlXYO96NlZYncA4b6uNrrERZMP5YiIUGWzeE0fh8k7jKM8R/YNpcFfzwjbzHpy36VwR4MO
 OnjNGQY+tnah45UgKSvRLsyX5bP70KGqjzVvxOS+X0dp6mR4VIclV+UquRmdgEePbn3mxC8Ru
 B2FyYUnCdvMRlFCZ3Hhk6FfNzKRqq/e6IoOYeeO6XhBBUXBlf5tu5CUGM0WyrER/IS/9XFJv1
 gvORp8wP58nKiZJ0Gi7oA7kn3qmgwhLrQm6z79BT/6ctvA2oRC0ajBDPrcB+QLsqOUv7oX7hy
 RZYYiMGTGlMHsRIs65E0GF1dnqAEIU/Uzu1
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36566
Cc: 36566 <at> debbugs.gnu.org, Noam Postavsky <npostavs@HIDDEN>
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 (-)

Gemini Lasswell <gazally@HIDDEN> writes:

> The easy fix for you for today is to set backtrace-line-length to 100 or
> less, which will make the initial values of print-length and print-level
> so low that little reprinting will be done.  Then use
> backtrace-expand-ellipsis (bound to "."), with or without C-u, on the
> lines where you want to see the full data structure.  And try "+" and
> "-" if you haven't already.

Ok, will have a look at these commands.  I've simply turned print-gensym
off for now in the debugger.


> I'll experiment with tweaking the heuristic to reduce the amount of
> reprinting it does, and let you know what I come up with.

Ok, great, tia.  Dunno if it would be worth it to optimize this test
printing, e.g. by turning print-gensym temporarily off.

> > BTW, extra points if the debugger provided commands/ a menu to tune such
> > settings (like printing variables) live when using it.
>
> There is such a command for print-circle (bound to "#") and it would be
> easy to add one for print-gensym, although I could use a keybinding
> suggestion.

You could use ":".  Or "# #" for print-circle and "# :" for print-gensym
(i.e. make "#" a prefix command).  This is inspired by print-circle
references looking like #N# and print syntax of gensyms looking like
#:NAME.

In any case, _please_ add both to the menu for discoverability, maybe
also the "global" version (i.e. 4 entries in sum).


BTW, when I eval this

(let ((x '#1=(1 . #1#)))
  (debug)
  (cons x x))

I get a backtrace like

Debugger entered: nil
  (let ((x '(1 . #6))) (debug) (cons x x))
  eval((let ((x '(1 . #7))) (debug) (cons x x)) t)

whereby when I hit C-u # all references get number 1, or start from 1
for every frame:

Debugger entered: nil
  (let ((x '#1=(1 . #1#))) (debug) (cons x x))
  eval((let ((x '#1=(1 . #1#))) (debug) (cons x x)) t)

Just a minor inconvenience, though.

Anyway, thanks for improving the debugger in this way so far, this is
very useful.


Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 14 Jul 2019 00:02:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 13 20:02:35 2019
Received: from localhost ([127.0.0.1]:43627 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hmRyN-0004uX-0b
	for submit <at> debbugs.gnu.org; Sat, 13 Jul 2019 20:02:35 -0400
Received: from aibo.runbox.com ([91.220.196.211]:48390)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gazally@HIDDEN>) id 1hmRyJ-0004uL-S4
 for 36566 <at> debbugs.gnu.org; Sat, 13 Jul 2019 20:02:33 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; 
 s=rbselector1;
 h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From;
 bh=hFqa7EHL09BXzAnV72R9dm1A73A4uLUGZ9SiAoNSqiw=; b=XNR5LmDrJglzWIVSAagPGLrR0i
 EqVnlxRMg+eON46lJVG8HPnCuPBkKnU3NrUfTle5du6MTyMD4fGV2E7ZgEsNrIQJxVl4vs/KumR0r
 j/yvmJx+HKdggpj8ofZAYq5uUlM4oJ98IcVZ2UFtT8aUdKnoXyir4q3UJvWZo/v+4GVeoIT8+5Lye
 lHIs06jSzm/aDUf+9owpoe5EJovnu7rtX0rCiLEZ80QqOiwSl8T6RefWUWIrjPb/J31cRMq0TtMTq
 d5GhqJQ0Xsc23tXKVFNV3srYfeDmRf0wOcEeqzCk2nK+7RgLhV2VdZYdmfvPhIJDme6wIS8Z8XoSO
 dtyCLs2Q==;
Received: from [10.9.9.203] (helo=mailfront21.runbox)
 by mailtransmit03.runbox with esmtp (Exim 4.86_2)
 (envelope-from <gazally@HIDDEN>)
 id 1hmRyH-00011L-B5; Sun, 14 Jul 2019 02:02:29 +0200
Received: by mailfront21.runbox with esmtpsa (uid:179284 )
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1)
 id 1hmRyG-0007Ya-Ai; Sun, 14 Jul 2019 02:02:28 +0200
From: Gemini Lasswell <gazally@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
References: <87r26yvb4r.fsf@HIDDEN> <871ryy2l1t.fsf@HIDDEN>
 <87r26xjyon.fsf@HIDDEN>
Date: Sat, 13 Jul 2019 17:02:19 -0700
In-Reply-To: <87r26xjyon.fsf@HIDDEN> (Michael Heerdegen's message of "Thu, 11
 Jul 2019 00:46:00 +0200")
Message-ID: <877e8llbzo.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36566
Cc: 36566 <at> debbugs.gnu.org, Noam Postavsky <npostavs@HIDDEN>
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 (-)

Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> With print-gemsym -> nil, the debugger needs approx. 2 seconds here to
> pop up, and with print-gemsym -> t, approx. 12.  So I wonder why this
> setting makes it that slow - I would expect a small time penalty, but
> such a big difference?

The C printing code builds hash tables to match gensyms to the numbers
they are printed with.  So it is building and discarding these hash
tables which causes the garbage collection and the slowdown.  Emacs 26's
backtrace printing is also significantly slower with print-gensym turned
on.

The reason master is so much slower than Emacs 26 is because of the
adaptive abbreviating I added to reduce problems with really long lines.
In Emacs 26 it's hard to debug things like magit or org-mode because
lines in the backtrace can easily get to be thousands or millions of
characters long and display gets really slow.  When I added
backtrace-mode, I gave it a target line length and a function which
starts with guesses at the appropriate values of print-length and
print-level, and which iteratively prints using those values, and if the
length of the printed representation is over the target, it reduces
print-length and print-level and tries again.  That reprinting, and
consequential repeated construction of gensym hash tables, is what's
making master slower than Emacs 26 in this case.

I remember when I was writing that function thinking that it was a
heuristic sort of algorithm and would likely need tweaking, so here we
are.

The easy fix for you for today is to set backtrace-line-length to 100 or
less, which will make the initial values of print-length and print-level
so low that little reprinting will be done.  Then use
backtrace-expand-ellipsis (bound to "."), with or without C-u, on the
lines where you want to see the full data structure.  And try "+" and
"-" if you haven't already.

I'll experiment with tweaking the heuristic to reduce the amount of
reprinting it does, and let you know what I come up with.

> BTW, extra points if the debugger provided commands/ a menu to tune such
> settings (like printing variables) live when using it.

There is such a command for print-circle (bound to "#") and it would be
easy to add one for print-gensym, although I could use a keybinding
suggestion.  backtrace-line-length is a defcustom.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 10 Jul 2019 22:46:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 10 18:46:18 2019
Received: from localhost ([127.0.0.1]:36793 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hlLLs-0004SR-Tb
	for submit <at> debbugs.gnu.org; Wed, 10 Jul 2019 18:46:18 -0400
Received: from mout.web.de ([212.227.15.4]:49183)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1hlLLo-0004S9-9L
 for 36566 <at> debbugs.gnu.org; Wed, 10 Jul 2019 18:46:15 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de;
 s=dbaedf251592; t=1562798764;
 bh=S1LvJC5hPluuYtt4+dzxY5YDXV9k4IqrB6MwDU3Md0g=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=Kxg9RVnj55412eYZI9sodviWhDVUOvQGgISf5xSM/hmA2qVsuqQ3WAUyOWshXPKyi
 i4S3b58A0mIlOrT1tSZJYXoRIe4HN1bzODdUgolV1wewX5hCIAF9Y1IXk42yRcny/M
 HHkob9sneVTZghN4WPGGSPkhu5X58YQtQfnrnMWk=
X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9
Received: from drachen.dragon ([92.208.178.213]) by smtp.web.de (mrweb001
 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MD8RQ-1hi1QN3TG0-00GYkx; Thu, 11
 Jul 2019 00:46:03 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Noam Postavsky <npostavs@HIDDEN>
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
References: <87r26yvb4r.fsf@HIDDEN> <871ryy2l1t.fsf@HIDDEN>
Date: Thu, 11 Jul 2019 00:46:00 +0200
In-Reply-To: <871ryy2l1t.fsf@HIDDEN> (Noam Postavsky's message of "Wed, 10
 Jul 2019 07:20:14 -0400")
Message-ID: <87r26xjyon.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Provags-ID: V03:K1:jTuzF5es/XQl/+htLSSp1rvb1BN70XOjqhZYx2esw6sXrvR7cFR
 4D2OadoZsUF1MW6Vc+HLMhJtxy6brQ6cLJs026tH4dHCb00qQjjB2W1Iv217Z3wFK8EQJg/
 zLEl35xf0OAATbn5Ek/OBfD2VjHyH+a3CJXZhCcIPZDa8VgmEg+8x/B/YWfkPJg4G/dD69p
 eCdKkufp/1MBodY0f/3/Q==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:wn5/YFH6gP4=:ZTu5BUwGoHAkCXKk3wzP2M
 xOQRqUFz2so/bENsIdMkpoStXSAMH36RvIBSwmktFE9yXroXW5jKTc/x9I/GPX3A44SVgQf4J
 BC6RBsiLrYpTrxIKr1uARIdx9lzfbx3sl9ssNaSEnPdVjip/newaqXbMsZQ2HOZDFvkFQW1nv
 /xPqn+ymiZukhGjN4I9M6WPbc0HOTwyNx78C8CTsNd1WjcIIm6Cayu+2eq+QPFwQQD2ugElcA
 Kl4N9FnZQ/tpNEp4a+CYGVLKLmlDfhsq2N9vD81ORKOD2BvG9YStb1sKDkGv2WYztW8ZeMfjF
 ej1iZrp5EH4Drzzasd3LdV3uNs3jWRcEB/w9kUusfFlyiwn4NCnWquyWCiLRh3IHdZ0Rq0keU
 pfgqtBTX14XQ1V3M+3uAXZA3P36UQH7fO7JRkRi/YT9+r4rSdyVcsnXxUcqTPNkq8GCuv6vgZ
 Jq/RC5txloBQUgO2ueGnak+2XYGyM4VIKoqj8NuSMU9mo+P4j30t+YCpYIS7eh9SYQxiMZulk
 BMlqp9Oi9TBoIy7Pvh9i+5JPnq6pNkFLaXn0Y6HJGc2D68r+wvQ9FvosBOGVAagyAjSZMAPBF
 CNDiAvZAjzEh3nYOzwSDOprtug0MQACX8mzeIYaXdlCG0x7iCwZT0q/wOjMPVvTAc8rOuDxzX
 225ZrBEOSdk6QvEN4wgpwS/Tvu3xM5n/PCeKbDcqrfyIfIfjGh8S2TcmIQip0FDgCQBJTSkFs
 TOZqNBEJ+siYc7cI7y0geQyLmv1H4qYjYucqSOjcO81VIhkhbngbkd17cbIY9IuzrfWrOwgoR
 j9zsi9IIWGfdEh3jI2L7KFgQnqr1GzfYp95Rgq45dxPukDDViZaiLb887/hQ1UR/sEDxNds7D
 dpHB5I8yGmfMsYNdEXsQ57l4K4PKP7XbzmUjf+lLuOCwOEdtnBVs0UeskVVvDsm8ubILaF5M+
 tn6rQsz9PSGFJcPkQsJeCYXJfyMSVLo68Rja0qll/w+k0sNTpfxc9Pth33EriaYyjYGvyGx2Y
 DbvILiVFBbzZGMN4KRE8GxlP4b29k+3GiDwmkUrD6wxwoFLmPvLtImky75MnFwoYT9o0R0weD
 t+0zrSnP8V8Z8k=
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36566
Cc: Gemini Lasswell <gazally@HIDDEN>, 36566 <at> debbugs.gnu.org
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 (-)

--=-=-=
Content-Type: text/plain

Noam Postavsky <npostavs@HIDDEN> writes:

> > sometimes it takes 10 or 20 seconds until the debugger pops up.  I
> > debugged code using widgets (who are complicated long lists).  But both
> > the number of frames and the length of the printed lists were not
> > exorbitant - a quite normal situation.
>
> Can you give an example recipe that produces the slowness?  It's not
> usually slow, right?  (When I trigger the debugger in master right now,
> I don't notice problem.)

I investigated a bit and found that the main factor of the sluggishness
seems to be my private (global) setting of print-gensym -> t: I can
toggle sluggishness in both the Emacs with my setup and emacs -Q just by
toggling this variable.  My debugger use case involves gensyms (see
later).  Ok, so it's probably mainly a printing issue.

Here is my use case: load the attached file (don't compile, I made it
contain a bug).  M-x find-cmd-widget, and insert a "links" expression
by hitting the INS button and select "links" with the "expr" button.

With print-gemsym -> nil, the debugger needs approx. 2 seconds here to
pop up, and with print-gemsym -> t, approx. 12.  So I wonder why this
setting makes it that slow - I would expect a small time penalty, but
such a big difference?

BTW, extra points if the debugger provided commands/ a menu to tune such
settings (like printing variables) live when using it.


--=-=-=
Content-Type: application/emacs-lisp
Content-Disposition: attachment; filename=find-cmd-widget.el
Content-Transfer-Encoding: quoted-printable

;;; find-cmd-widget.el --- Build a valid find(1) command with widgets -*- l=
exical-binding: t -*-

;; Copyright (C) 2019 Free Software Foundation, Inc

;; Author: Michael Heerdegen <michael_heerdegen@HIDDEN>
;; Maintainer: Michael Heerdegen <michael_heerdegen@HIDDEN>
;; Created: 10 Jun 2019
;; Keywords: convenience
;; Compatibility: GNU Emacs 26
;; Version: 0.1
;; Package-Requires: ((emacs "26"))


;; This file is not part of GNU Emacs.

;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; ...

;;; Code:

;;;; Requirements

(require 'widget)
(require 'find-cmd)
(require 'subr-x)
(require 'cus-edit)
(eval-when-compile (require 'wid-edit))


;;;; Variables

(defvar find-cmd-widget-find-arg-alist
  ;; elements are (symbol make-widget-fun category annotation hint-string)
  ;;               0      1               2        3          4
  '(
    ;; generic tests
    (amin       find-cmd-widget-make-time-minutes-widget   "Tests"
                "Minutes since file last accessed")
    (anewer     find-cmd-widget-make-xnewer-widget         "Tests"
                "Last accessed more recently than a specified file was modi=
fied")
    (atime      find-cmd-widget-make-time-days-widget      "Tests"
                "Days since file last accessed (rounded down; see also `day=
start`)")
    (cmin       find-cmd-widget-make-time-minutes-widget   "Tests"
                "Minutes since last status change")
    (cnewer     find-cmd-widget-make-xnewer-widget         "Tests"
                "Status changed more recently than a specified file was mod=
ified")
    (ctime      find-cmd-widget-make-time-days-widget      "Tests"
                "Days since last status change (rounded down; see also `day=
start`)")
    (empty      find-cmd-widget-make-choice-widget         "Tests"
                "Empty regular file or directory")
    (executable find-cmd-widget-make-choice-widget         "Tests"
                "File is executable/ Dir is searchable")
    (false      find-cmd-widget-make-choice-widget         "Tests"
                "Always false")
    (fstype     find-cmd-widget-make-editable-field-widget "Tests")
    (gid        find-cmd-widget-make-editable-field-widget "Tests")
    (group      find-cmd-widget-make-editable-field-widget "Tests")
    (ilname     find-cmd-widget-make-lname-widget          "Tests"
                "Case insensitive version of `lname`"
                "shell glob pattern; must match the complete name")
    (iname      find-cmd-widget-make-editable-field-widget "Tests"
                "Like `name` but match is case insensitive"
                "shell glob pattern; must match the complete name")
    (inum       find-cmd-widget-make-editable-field-widget "Tests")
    (ipath      find-cmd-widget-make-editable-field-widget "Tests"
                "Like `path` but match is case insensitive"
                "shell glob pattern; must match the complete path")
    (iregex     find-cmd-widget-make-editable-field-widget "Tests")
    ;; (iwholename (1) "tests") ; same as `ipath`
    (links      find-cmd-widget-make-links-widget          "Tests"
                "Number of hard links")
    (lname      find-cmd-widget-make-lname-widget          "Tests"
                "symlink whose contents match a shell pattern"
                "shell glob pattern; must match the complete name")
    (mmin       find-cmd-widget-make-time-minutes-widget   "Tests"
                "Minutes since last data change")
    (mtime      find-cmd-widget-make-time-days-widget      "Tests"
                "Days since last data change (rounded down; see also `dayst=
art`)")
    (name       find-cmd-widget-make-editable-field-widget "Tests"
                "Match shell pattern against base of file name"
                "shell glob pattern; must match the complete name")
    (newer      find-cmd-widget-make-editable-field-widget "Tests")
    (nogroup    find-cmd-widget-make-choice-widget         "Tests"
                "No group corresponds to file's numeric group ID")
    (nouser     find-cmd-widget-make-choice-widget         "Tests"
                "No user corresponds to file's numeric user ID")
    (path       find-cmd-widget-make-editable-field-widget "Tests"
                "Match shell pattern against complete file name"
                "shell glob pattern; must match the complete path")
    (perm       find-cmd-widget-make-choice-widget         "Tests")
    (readable   find-cmd-widget-make-choice-widget         "Tests" "Readabl=
e file")
    (regex      find-cmd-widget-make-editable-field-widget "Tests")
    (samefile   find-cmd-widget-make-editable-field-widget "Tests")
    (size       find-cmd-widget-make-editable-field-widget "Tests")
    (true       find-cmd-widget-make-choice-widget         "Tests" "Always =
true")
    (type       find-cmd-widget-make-type-widget           "Tests" "File Ty=
pe")
    (uid        find-cmd-widget-make-editable-field-widget "Tests")
    (used       find-cmd-widget-make-editable-field-widget "Tests")
    (user       find-cmd-widget-make-editable-field-widget "Tests"
                "File owned by specified user" "numeric user ID allowed")
    ;; (wholename  (1) "tests") ; same as `path`
    (writable   find-cmd-widget-make-choice-widget         "Tests" "Writabl=
e file")
    (xtype      find-cmd-widget-make-type-widget           "Tests" "File or=
 link target type")

    ;; normal options (always true)
    (daystart              find-cmd-widget-make-choice-widget         "Opti=
ons")
    (depth                 find-cmd-widget-make-choice-widget         "Opti=
ons")
    (maxdepth              find-cmd-widget-make-editable-field-widget "Opti=
ons")
    (mindepth              find-cmd-widget-make-editable-field-widget "Opti=
ons")
    (mount                 find-cmd-widget-make-choice-widget         "Opti=
ons")
    (noleaf                find-cmd-widget-make-choice-widget         "Opti=
ons")
    (ignore_readdir_race   find-cmd-widget-make-choice-widget         "Opti=
ons")
    (noignore_readdir_race find-cmd-widget-make-choice-widget         "Opti=
ons")
    (regextype             find-cmd-widget-make-editable-field-widget "Opti=
ons")
    (xdev                  find-cmd-widget-make-choice-widget         "Opti=
ons")

    (and   find-cmd-widget-make-combiner-widget "Combiners")
    (not   find-cmd-widget-make-combiner-widget "Combiners")
    (or    find-cmd-widget-make-combiner-widget "Combiners")
    (prune find-cmd-widget-make-combiner-widget "Combiners")

    ;; actions
    (delete  find-cmd-widget-make-choice-widget         "Actions")
    (print0  find-cmd-widget-make-choice-widget         "Actions")
    (printf  find-cmd-widget-make-editable-field-widget "Actions")
    (fprintf find-cmd-widget-make-editable-field-widget "Actions") ;fixme: =
gets two args!
    (print   find-cmd-widget-make-choice-widget         "Actions")
    (fprint0 find-cmd-widget-make-editable-field-widget "Actions")
    (fprint  find-cmd-widget-make-editable-field-widget "Actions")
    (ls      find-cmd-widget-make-choice-widget         "Actions")
    (fls     find-cmd-widget-make-editable-field-widget "Actions")
    (prune   find-cmd-widget-make-choice-widget         "Actions")
    (quit    find-cmd-widget-make-choice-widget         "Actions")

    ;; these need to be terminated with a ;
    (exec    find-cmd-widget-make-editable-field-widget "Actions")
    (ok      find-cmd-widget-make-editable-field-widget "Actions")
    (execdir find-cmd-widget-make-editable-field-widget "Actions")
    (okdir   find-cmd-widget-make-editable-field-widget "Actions"))
  "Doc...")

(defvar find-cmd-widget-find-global-option-arglist
  '(;; switches
    (L find-cmd-widget-make-choice-widget "Switches")
    (P find-cmd-widget-make-choice-widget "Switches")
    (H find-cmd-widget-make-choice-widget "Switches"))
  "Doc...")

(defvar-local find-cmd-widget-main-widget nil)
(defvar-local find-cmd-widget-preview-widget-1 nil)
(defvar-local find-cmd-widget-preview-widget-2 nil)
(defvar-local find-cmd-widget-warning-widget nil)

(defvar-local find-cmd-widget-current-global-option nil)
(defvar-local find-cmd-widget-warnings '())


;;;; Helpers

(defun find-cmd-widget--just-true (_) t)

(defun find-cmd-widget--warn-arg-not-implemented (arg)
  (when arg (warn "Argument not implemented")))

(defun find-cmd-widget--parse-widget-sexp (sexp)
  `(,@(when-let ((opt (car sexp))) `(,opt)) ,@(cadr sexp)))

(defun find-cmd-widget-create-find-cmd (sexp)
  `(find-cmd ,(find-cmd-widget--parse-widget-sexp (cdr sexp))))

(defun find-cmd-widget-find-call-get-dir+exps (sexp)
  (list (car sexp)
        (mapconcat #'find-to-string (find-cmd-widget--parse-widget-sexp (cd=
r sexp)) "")))

(defun find-cmd-widget--build-dirs-string (dirs &optional no-shell-quote)
  (mapconcat (if no-shell-quote #'identity #'shell-quote-argument)
             (mapcar #'expand-file-name dirs) " "))

(defun find-cmd-widget-create-find-call (sexp)
  ;; We do that manually because `find-cmd' doesn't yet handle multiple
  ;; search paths
  (let* ((dirs+exps (find-cmd-widget-find-call-get-dir+exps sexp))
         (dirs (car dirs+exps)))
    (concat find-program
            (if dirs
                (concat " " (concat (find-cmd-widget--build-dirs-string dir=
s)))
              "")
            " "
            (cadr dirs+exps))))

(defun find-cmd-widget-menu-choice-action (&rest args)
  (cl-letf (((symbol-function #'widget-choose)
             #'find-cmd-widget--widget-choose))
    ;; this doesn't notify the parent widget, but it should
    (apply #'widget-choice-action args)))

(defun find-cmd-widget--widget-choose (title items &optional event)
  (let ((widget-menu-max-size 100))
    (if event
        ;; mouse click
        (let* (chosen-item
               (make-item
                (lambda (i)
                  (let* ((s (car i))
                         (e (assoc (intern s) find-cmd-widget-find-arg-alis=
t)))
                    (vector s (lambda () (interactive) (setq chosen-item (c=
dr i)))
                            :help (nth 3 e))))))
          (popup-menu
           `(,title
             (keymap
              ("By category"
               ,@(mapcar
                  (pcase-lambda (`(,cat . ,items))
                    `(,cat ,@(mapcar make-item items)))
                  (seq-group-by
                   (lambda (item)
                     (nth 2 (assoc (intern (car item)) find-cmd-widget-find=
-arg-alist)))
                   items)))
              ,@(mapcar make-item (cl-sort items #'string< :key #'car))))
           event)
          chosen-item)
      (setq items (cl-remove-if 'stringp items))
      (let* ((max-item-length (apply #'max
                                     (mapcar (lambda (e) (length (symbol-na=
me (car e))))
                                             find-cmd-widget-find-arg-alist=
)))
             (max-cat-length  (apply #'max
                                     (mapcar #'length (mapcar #'caddr find-=
cmd-widget-find-arg-alist))))
             (completions-format 'vertical)
             (val (completing-read
                   (concat title ": ")
                   (lambda (string pred action)
                     (if (eq action 'metadata)
	                 `(metadata
                           (display-sort-function . ,#'identity)
                           (annotation-function
                            .
                            ,(lambda (s)
                               (when-let ((entry (assoc (intern-soft s)
                                                        find-cmd-widget-fin=
d-arg-alist)))
                                 (let ((category (nth 2 entry))
                                       (description (nth 3 entry)))
                                   (and (or category description)
                                        (concat (make-string (- max-item-le=
ngth (length s)) ?\ )
                                                (format "[%s]" category)
                                                (make-string
                                                 (- max-cat-length (length =
category)) ?\ )
                                                (if description description=
 ""))))))))
                       (complete-with-action action items string pred)))
                   nil t)))
	(if (stringp val)
	    (let ((try (try-completion val items)))
	      (when (stringp try)
		(setq val try))
	      (cdr (assoc val items))))))))

(defun find-cmd-widget--value-get-1 (command)
  (lambda (w) (list command (widget-field-value-get w))))

(defalias 'find-cmd-widget--get-arg
  (pcase-lambda ((and `(,name ,(and (pred functionp) make-widget) . ,rest)
                      (let hint (nth 2 rest))))
    (ignore rest)
    (funcall make-widget name hint)))

(defun find-cmd-widget-find-action (&rest _)
  (interactive)
  (async-shell-command (widget-value find-cmd-widget-preview-widget-2)))

(defun find-cmd-widget-find-dired-action (&rest _)
  (interactive)
  (let ((args (find-cmd-widget-find-call-get-dir+exps (widget-value find-cm=
d-widget-main-widget))))
    (when (cdr (car args))
      (user-error "find-dired currently supports only one path, sorry"))
    (setf (car args) (if (car args) (find-cmd-widget--build-dirs-string (ca=
r args) 'no-quote) "."))
    (apply #'find-dired args)))


;;;; Widget definitions

(define-widget 'find-cmd-preview 'item
  "Doc..."
  :format "%v"
  :value-face 'highlight
  :value-create #'widget-field-value-create
  ;; (lambda (w)
  ;;   (insert (propertize (widget-get w :value) 'face 'success)))
  )

(defvar find-cmd-widget-sign-args
  (mapcar (pcase-lambda (`(,sign ,descr ,val))
            (cons sign
                  `(choice-item :tag ,descr
                                :value-inline ,(lambda (_w) `(,val)))))
          '((< "less than" "-") (> "greater than" "+") (=3D "exactly" ""))))

(define-widget 'find-cmd-widget-sign 'menu-choice
  "Doc..."
  :format "sign: %v"
  :args (mapcar #'cdr find-cmd-widget-sign-args))

(defun find-cmd-widget-make-choice-widget (name hint)
  (find-cmd-widget--warn-arg-not-implemented hint)
  `(choice-item :tag ,(symbol-name name)
                :value-get ,(lambda (_w) (list name))))

(define-widget 'find-cmd-widget-editable-field 'editable-field
  "Doc..."
  :size 2
  :validate #'find-cmd-widget--just-true
  :value-get (lambda (w) (list (intern (widget-get w :menu-tag)) (widget-fi=
eld-value-get w)))
  :keymap widget-field-keymap)

(defun find-cmd-widget-make-editable-field-widget (name &optional hint)
  (let ((name-string (symbol-name name)))
    `(find-cmd-widget-editable-field
      :menu-tag ,name-string
      :format ,(concat name-string ": %v" (and hint (format "  (%s)" hint))=
 "\n"))))

(defun find-cmd-widget-make-lname-widget (name &optional hint)
  (let ((name-string (symbol-name name)))
    `(find-cmd-widget-editable-field
      :menu-tag ,name-string
      :format ,(concat name-string ": %v" (and hint (format "  (%s)" hint))=
 "\n")
      :value-get
      ,(lambda (w)
         (when (eq 'L (car find-cmd-widget-current-global-option))
           (push (format "Global option \"-L\" and \"-%s\" used together" n=
ame-string)
                 find-cmd-widget-warnings))
         (list name (widget-field-value-get w))))))

(define-widget 'find-cmd-widget-n 'find-cmd-widget-editable-field
  "Widget to input find(1) n option arguments.")

(defun find-cmd-widget-make-n-widget (tag &optional hint)
  `(find-cmd-widget-n
    :menu-tag ,tag
    :format ,(concat tag ": %v" (and hint (format "  (%s)" hint)) "\n")))

(defun find-cmd-widget-make-signed-n-widget (name hint unit &optional defau=
lt-sign)
  (find-cmd-widget--warn-arg-not-implemented hint)
  (let ((sname (symbol-name name)))
    `(group
      :tag ,sname
      :format ,(format "%s          [%s]\n%%v"
                       sname
                       (nth 3 (assoc name find-cmd-widget-find-arg-alist)))
      :value-get ,(lambda (w) `(,name ,(apply #'concat (widget-editable-lis=
t-value-get w))))
      :args
      ((find-cmd-widget-sign
        ,@(and default-sign `(:explicit-choice ,(assoc default-sign find-cm=
d-widget-sign-args))))
       ,(let ((w (find-cmd-widget-make-n-widget unit nil)))
          (widget-put w :value-get #'widget-field-value-get)
          w)))))

(defun find-cmd-widget-make-time-days-widget (name hint)
  (find-cmd-widget-make-signed-n-widget name hint "days" '<))

(defun find-cmd-widget-make-time-minutes-widget (name hint)
  (find-cmd-widget-make-signed-n-widget name hint "minutes" '<))

(defun find-cmd-widget-make-links-widget (name hint)
  (find-cmd-widget-make-signed-n-widget name hint "links" '=3D))

(defun find-cmd-widget-make-type-widget (name hint)
  (find-cmd-widget--warn-arg-not-implemented hint)
  (cl-flet ((vget (s) (lambda (_w) (list (list s)))))
    `(checklist :tag ,(symbol-name name)
                :format "file type:\n%v"
                :value-get ;; validate here since :validate it tricky
                ,(lambda (w)
                   (let ((v (widget-checklist-value-get w)))
                     (when (and (eq name 'type)
                                (eq 'L (car find-cmd-widget-current-global-=
option))
                                (seq-some (lambda (x) (string=3D (car x) "l=
")) v))
                       (push "Global option \"-L\"- and -type l (\"symbolic=
 link\") used together"
                             find-cmd-widget-warnings))
                     `(,name ,(mapconcat #'car v ","))))
                :args ((choice-item :tag "regular file"                   :=
value-inline ,(vget "f"))
                       (choice-item :tag "directory"                      :=
value-inline ,(vget "d"))
                       (choice-item :tag "symbolic link"                  :=
value-inline ,(vget "l"))
                       (choice-item :tag "block (buffered) special"       :=
value-inline ,(vget "b"))
                       (choice-item :tag "character (unbuffered) special" :=
value-inline ,(vget "c"))
                       (choice-item :tag "named pipe (FIFO)"              :=
value-inline ,(vget "p"))
                       (choice-item :tag "socked"                         :=
value-inline ,(vget "s"))
                       (choice-item :tag "door (Solaris)"                 :=
value-inline ,(vget "D"))))))

(defun find-cmd-widget-make-combiner-widget (combiner hint)
  (find-cmd-widget--warn-arg-not-implemented hint)
  (let ((sname (symbol-name combiner)))
    `(find-expr :tag ,sname
                :format ,(concat sname "\n%v")
                :value-inline ,(lambda (w) `((,combiner ,@(widget-child-val=
ue-get w)))))))

(define-widget 'find-cmd-widget-file-widget 'item
  "Doc..."
  :action (lambda (w &rest _)
            (widget-value-set w (funcall (widget-get w :read-file-name-fun)=
 w))
            (widget-apply w :notify w))
  :read-file-name-fun (lambda (w) (read-file-name "Dir: " nil (widget-value=
-value-get w)))
  :value "")

;; FIXME: Doesn't work
(defun find-cmd-widget-make-xnewer-widget (name hint)
  `(find-cmd-widget-file-widget
    :value-get ,(lambda (w) `(,name ,(expand-file-name (widget-value-value-=
get w))))
    :tag ,(symbol-name name)
    :format ,(concat "%[file%]: %v" (when hint (format "          [%s]" hin=
t)) "\n")))

(define-widget 'find-expr 'lazy
  "Doc..."
  :format "...:\n%v"
  :type `(editable-list
          ;; :entry-format "%i\n%d %v" ;; that breaks intendation; %n not
          ;; implemented in `widget-editable-list-entry-create' :-(
          :args
          ((menu-choice
            :tag "expr"
            :explicit-choice ,(find-cmd-widget--get-arg (assoc 'iname find-=
cmd-widget-find-arg-alist))
            :value "*"
            :action find-cmd-widget-menu-choice-action
            :args ,(mapcar #'find-cmd-widget--get-arg find-cmd-widget-find-=
arg-alist)))))

(define-widget 'find-cmd-widget-global-option 'menu-choice
  "Doc..."
  :format "global options: %v\n"
  :action 'find-cmd-widget-menu-choice-action
  :notify (lambda (w &rest args)
            (setq find-cmd-widget-current-global-option (widget-value w))
            (apply #'widget-default-notify w args))
  :args (cons `(choice-item :tag "none"
                            :value-get ,(lambda (_w) nil))
              (mapcar #'find-cmd-widget--get-arg
                      find-cmd-widget-find-global-option-arglist)))

(define-widget 'find 'group
  "Doc..."
  :format "%v"
  :value-get (lambda (w)
               (setq find-cmd-widget-warnings '())
               (widget-editable-list-value-get w))
  :notify (pcase-lambda ((app widget-value v) &rest _)
            (widget-value-set find-cmd-widget-preview-widget-1
                              (string-trim-right
                               (pp-to-string
                                (find-cmd-widget-create-find-cmd v))))
            (widget-value-set find-cmd-widget-preview-widget-2
                              (find-cmd-widget-create-find-call v))
            (widget-value-set find-cmd-widget-warning-widget
                              (if find-cmd-widget-warnings
                                  (mapconcat
                                   (apply-partially #'concat "Warning: ")
                                   find-cmd-widget-warnings "\n")
                                "")))
  :args
  `((editable-list
     :format "paths:\n%v%i\n"
     :args
     ((find-cmd-widget-file-widget
       :format "find %[path%]: %v\n"
       ;; initialize VALUE dynamically:
       :convert-widget
       ,(lambda (widget)
          (widget-put widget :value default-directory)
          (widget-put widget :args nil)
          widget)
       :read-file-name-fun ,(lambda (w) (read-directory-name "Dir: " (widge=
t-value w))))))
    (find-cmd-widget-global-option)
    (find-expr :format "expressions:\n%v")))


;;;; Main commands

;;;###autoload
(defun find-cmd-widget ()
  "Doc..."
  (interactive)
  (let ((buf (generate-new-buffer "*Widget Find*")))
    (pop-to-buffer buf)
    (kill-all-local-variables)
    (let ((inhibit-read-only t))
      (erase-buffer))
    (remove-overlays)
    (custom--initialize-widget-variables)
    (setq-local find-cmd-widget-main-widget (widget-create 'find))
    (setq-local find-cmd-widget-warning-widget
                (widget-create 'find-cmd-preview
                               :value ""
                               :value-face 'error))
    (let ((arrow ?=E2=87=A9))
      (when (char-displayable-p arrow)
        (insert (propertize (concat "    " (string arrow)) 'face '(:height =
2.0)) "\n"))
      (setq-local find-cmd-widget-preview-widget-1
                  (widget-create 'find-cmd-preview
                                 :value "Here will appear a `find-cmd' prev=
iew"))
      (insert "                     ")
      (widget-create 'push-button
                     :tag "Copy!"
                     :help-echo "Copy `find-cmd' call to kill ring"
                     :action (lambda (&rest _)
                               (let ((s (widget-value find-cmd-widget-previ=
ew-widget-1)))
                                 (kill-new s)
                                 (message "%s" s))))
      (insert "\n")
      (when (char-displayable-p arrow)
        (insert (propertize (concat "    " (string arrow)) 'face '(:height =
2.0)) "\n"))
      (setq-local find-cmd-widget-preview-widget-2
                  (widget-create 'find-cmd-preview :value "\
Here will appear a preview for the constructed find(1) call"))
      (insert "                     ")
      (widget-create 'push-button
                     :tag "Copy!"
                     :help-echo "Copy \"find\" call to kill ring"
                     :action (lambda (&rest _)
                               (let ((s (widget-value find-cmd-widget-previ=
ew-widget-2)))
                                 (kill-new s)
                                 (message "%s" s)))))
    (insert "\n\n\n")
    (widget-create 'push-button
                   :tag "find!"
	           :help-echo "Run constructed find command"
                   :action #'find-cmd-widget-find-action)
    (insert "  ")
    (widget-create 'push-button
                   :tag "find-dired!"
	           :help-echo "Run constructed find command as find-dired"
                   :action #'find-cmd-widget-find-dired-action)
    (insert "\n")
    (use-local-map (let ((map (make-sparse-keymap)))
                     (set-keymap-parent map widget-keymap)
                     (define-key map [(control ?c) (control ?c)]
                       #'find-cmd-widget-find-dired-action)
                     map))
    (widget-setup)
    (goto-char (point-min))))

(provide 'find-cmd-widget)
;;; find-cmd-widget.el ends here

--=-=-=
Content-Type: text/plain



Thanks,

Michael.

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 10 Jul 2019 11:20:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 10 07:20:26 2019
Received: from localhost ([127.0.0.1]:34915 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hlAeA-0004KA-9W
	for submit <at> debbugs.gnu.org; Wed, 10 Jul 2019 07:20:26 -0400
Received: from mail-io1-f46.google.com ([209.85.166.46]:44275)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1hlAe9-0004Jv-8H
 for 36566 <at> debbugs.gnu.org; Wed, 10 Jul 2019 07:20:25 -0400
Received: by mail-io1-f46.google.com with SMTP id s7so3786847iob.11
 for <36566 <at> debbugs.gnu.org>; Wed, 10 Jul 2019 04:20:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=cFEZj/hauSzbA/cN2iqghyXi8Cz2D7V5fEljfTD9sfY=;
 b=WgNB+qAL5naOnA97a1yvPO/fzHgcKhcuLrPESJvUll9mXRaP8OEctab10pjEafVuwN
 W0EuVclJ69egDUpJ1qY3jVhhYa2s0w5Np30vfbf+GUxJajT8aRo/z+NbgwdzD79KvQjx
 v3TPNuULR7Tm9R+J1aRcg6O+OVgb8972+wMRE3AdO5jC4isA+DhH8E5yuoNpoO3wv3oH
 lnrFhVFbWXRXKDSma4/m74ZxpGYAUi3A+TcpSj6bOB2Pcfdi5dkSiWoNbCG2z4zPGru5
 npUz/JgtnMWOxQFL49cjyunDU6zcJKqOMy8WqoEgASrPB7wSm2kPOKaqRdAZbGL5lEEp
 HCjQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=cFEZj/hauSzbA/cN2iqghyXi8Cz2D7V5fEljfTD9sfY=;
 b=Ia6f33Xv07STI2L/h39nlXtLqdY0XiwaDIoWjeSPAVrO/x110n9irGDChplQ9SVB28
 aiBYDrlW8GIVVcbKqiCanQY6ABNoqO5SvEgeWAXEao9eI/8RaQJfb0tEmxIKy6FXaJgD
 sUn8Z9xgH0h90VY3QGOavZVDZ0akcQ7BwjhOHfcWC6puvkL0+4ve0G8Az+9dH3UE7md4
 cjFtyM/Ix5K2rkzuO7XYLGBjwDgb9RHU8a0lWfSL+lbFRhI9xqJ5IOzjvmEosrWoRJoQ
 i83VoRE1CUf1DoSZ1U4wmy0FNHIGkXj1hO+mTIOfSagT5/hpaTaYoDlIT51JWQWVtUIN
 CPjA==
X-Gm-Message-State: APjAAAXhdp+UjjA3bmrvpWDtbosw9l3Jv6TlLBk7is1oX/25KZO1zVPb
 Lygoof2ee9gYpAxUkqXXJTc=
X-Google-Smtp-Source: APXvYqwxY5HHx1da5sThRjN5hczyKIIhNU2ChyftxdNHL7jB94EsUf2LmE3eN+8E6qEllb2usC+SFQ==
X-Received: by 2002:a5d:8ccc:: with SMTP id k12mr7346604iot.141.1562757615757; 
 Wed, 10 Jul 2019 04:20:15 -0700 (PDT)
Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.gmail.com with ESMTPSA id
 n22sm2932370iob.37.2019.07.10.04.20.14
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 10 Jul 2019 04:20:14 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#36566: 27.0.50; debug is sometimes horribly slow
References: <87r26yvb4r.fsf@HIDDEN>
Date: Wed, 10 Jul 2019 07:20:14 -0400
In-Reply-To: <87r26yvb4r.fsf@HIDDEN> (Michael Heerdegen's message of "Wed, 10
 Jul 2019 05:09:24 +0200")
Message-ID: <871ryy2l1t.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2.90 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Michael Heerdegen writes: > > sometimes it takes 10 or 20
 seconds until the debugger pops up. I > debugged code using widgets (who are
 complicated long lists). But both > the number of frames and th [...] 
 Content analysis details:   (1.3 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (npostavs[at]gmail.com)
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.166.46 listed in list.dnswl.org]
 1.3 PDS_NO_HELO_DNS        High profile HELO but no A record
X-Debbugs-Envelope-To: 36566
Cc: Gemini Lasswell <gazally@HIDDEN>, 36566 <at> debbugs.gnu.org
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.3 (/)

Michael Heerdegen <michael_heerdegen@HIDDEN> writes:
>
> sometimes it takes 10 or 20 seconds until the debugger pops up.  I
> debugged code using widgets (who are complicated long lists).  But both
> the number of frames and the length of the printed lists were not
> exorbitant - a quite normal situation.

Can you give an example recipe that produces the slowness?  It's not
usually slow, right?  (When I trigger the debugger in master right now,
I don't notice problem.)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at 36566 <at> debbugs.gnu.org:


Received: (at 36566) by debbugs.gnu.org; 10 Jul 2019 03:20:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 09 23:20:26 2019
Received: from localhost ([127.0.0.1]:34683 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hl39e-0002iC-4V
	for submit <at> debbugs.gnu.org; Tue, 09 Jul 2019 23:20:26 -0400
Received: from userp2130.oracle.com ([156.151.31.86]:48644)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1hl39b-0002hx-JN
 for 36566 <at> debbugs.gnu.org; Tue, 09 Jul 2019 23:20:24 -0400
Received: from pps.filterd (userp2130.oracle.com [127.0.0.1])
 by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x6A3IiWr126889;
 Wed, 10 Jul 2019 03:20:17 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02;
 bh=yNWhUOH7h+w09FBNIPL79nF8pU+Qgw6rgNRvqcxBSag=;
 b=WkDClFLcNPcncQXO+tJ3AInQ917OckKIMz1fcLuLgpn3CLwKkkSU12zzs/Fbcblrd4T5
 VNmXL6AMQ77ZcJT12fjHlrTyHaXDXxV1tLPcoqMUKnzy2y1CuXODRjFvdfsdOEM152jt
 zQnqPTwE+f2ZcH1PwKA5SPUm5x2RPa4frCCS/ow9Wkxn0s63OojAsMWjSv6le+rUDq0s
 Na7Bf1uib9YeU8oIJA0qnRsyjOCc7QWmZJMximofO5vxdRzPaRBgENyZ7TqTy+lp3QsQ
 9vl+V7f6Lzr3WP1Ue+chaWva4L/eDjK/q9jLYcMDd8Zk1mYtgiTj92tz91ZJdS3Jhmch AQ== 
Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71])
 by userp2130.oracle.com with ESMTP id 2tjk2tqkfe-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Wed, 10 Jul 2019 03:20:17 +0000
Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1])
 by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x6A3I80w030564;
 Wed, 10 Jul 2019 03:18:16 GMT
Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72])
 by aserp3030.oracle.com with ESMTP id 2tmwgx8g72-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Wed, 10 Jul 2019 03:18:16 +0000
Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18])
 by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x6A3IBsF010510;
 Wed, 10 Jul 2019 03:18:11 GMT
MIME-Version: 1.0
Message-ID: <37aa3538-c1be-4503-9785-96d8ebfce3a9@default>
Date: Tue, 9 Jul 2019 20:18:10 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>, 36566 <at> debbugs.gnu.org
Subject: RE: bug#36566: 27.0.50; debug is sometimes horribly slow
References: <87r26yvb4r.fsf@HIDDEN>
In-Reply-To: <87r26yvb4r.fsf@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.4861.0 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9313
 signatures=668688
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=996
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.0.1-1810050000 definitions=main-1907100040
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9313
 signatures=668688
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
 priorityscore=1501 malwarescore=0
 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011
 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000
 definitions=main-1907100040
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 36566
Cc: Gemini Lasswell <gazally@HIDDEN>
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 (---)

> sometimes it takes 10 or 20 seconds until the debugger pops up.  I
> debugged code using widgets (who are complicated long lists).  But both
> the number of frames and the length of the printed lists were not
> exorbitant - a quite normal situation.
>=20
> When I revert
>=20
> e09120d68694272ea5efbe13b16936b4382389d8
> Add backtrace-mode and use it in the debugger, ERT and Edebug
>=20
> the debugger becomes fast again and pops up in a reasonable time.  With
> the commit, the debugger is quite unusable in some cases: stepping
> (`debugger-step-through') takes ten seconds per hit etc.  Not good.
>=20
> FWIW, I think I very much appreciate the cited commit - I didn't yet
> make use of the added features but it seems to be cool.  I hope we can
> find a solution here.  At least there should be a way to get a faster
> behavior.  BTW, I used the profiler and found that most of the time is
> spent while garbage collecting.  My first thought was that cl-print may
> be the culprit but that doesn't seem to be the case.

BTW:
Is there a way to "turn off" the feature introduced
by the commit, even if most people want it on most
of the time?  (I'm not familiar with the feature,
but it sounds like something some users might want
to turn off sometimes.)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Jul 2019 03:09:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 09 23:09:38 2019
Received: from localhost ([127.0.0.1]:34667 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hl2zC-0002F6-H5
	for submit <at> debbugs.gnu.org; Tue, 09 Jul 2019 23:09:38 -0400
Received: from lists.gnu.org ([209.51.188.17]:39256)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1hl2zB-0002Ev-6V
 for submit <at> debbugs.gnu.org; Tue, 09 Jul 2019 23:09:37 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:35645)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1hl2zA-0004Cn-8N
 for bug-gnu-emacs@HIDDEN; Tue, 09 Jul 2019 23:09:37 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 RCVD_IN_DNSWL_NONE autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1hl2z8-0006CD-CM
 for bug-gnu-emacs@HIDDEN; Tue, 09 Jul 2019 23:09:36 -0400
Received: from mout.web.de ([212.227.15.14]:34303)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1hl2z7-00067Z-Vq
 for bug-gnu-emacs@HIDDEN; Tue, 09 Jul 2019 23:09:34 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de;
 s=dbaedf251592; t=1562728168;
 bh=jKXfLoS46B3JZ31myzKcQkTZMtNhZRxjfxr4w5DCWJQ=;
 h=X-UI-Sender-Class:From:To:Subject:CC:Date;
 b=DhcBpstH7gnsJYckqRtVs/QgwYxeneDAkPHWmv6/HC/d6XwYkHoMzQXQEK5DTXNKM
 LwRwcZWxY3ZdY2vEgxGwnRMvvCAFHXFrLPzwcXO0i/nfMxNgQn/CxodfsRJ5dpUkV6
 q7427MM92q8+b9UlVraUCn426zpqJJfVfHISvDN8=
X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9
Received: from drachen.dragon ([94.216.191.242]) by smtp.web.de (mrweb004
 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LuqfJ-1iSsA23kY5-0105dR; Wed, 10
 Jul 2019 05:09:27 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.0.50; debug is sometimes horribly slow
Date: Wed, 10 Jul 2019 05:09:24 +0200
Message-ID: <87r26yvb4r.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:+/TMgPD1voDLTNDDUbo4Esh099aMLcWzA4kPnwbfdY3Jbp9kuBA
 wdcQ0HhSE+N4YuLfcC+M3IQ6h8fHcXEeS4EQH4iV/8YZp+ZQ6wSPZKKe0zinSpDk8fk5TQw
 dweJH+ZFIrv+lezAjo1B3LearKKulJ8TtwffWDO3qSoUnQxcPK1r4f0xKPZgCD35bIfYEfT
 S6KIEQt7CThikcMDukzSQ==
X-UI-Out-Filterresults: notjunk:1;V03:K0:UGbH91V0R7Q=:/tRyPbweosIpSIWiVSkOfQ
 jWzFBhdGFJrsE4QLb3ZPyk0utN8n6upV85dbFO83cXG4NLZr2vLVXv7HjTU9qYbtaxPp3eOYY
 +BHMqcno2NLNucwN07QtE2nCMW1SpfFNZRGpyc/4fZKQnxPdKnm2yKWjiZkFKU7xWi/K/lNg1
 azndEKaT0XSxbG3eG1wPukZjjsVTLhlysq6xamgNyIkOU18iPHlQeX6KyAYBWiktvx0S/VmxW
 xIX+f2E7VX8wSgS3jS6CSai3AwrLeH8vuL+oTozKEaxnzHNMvmWJ3ZrR5jZMJuXHtRqPgNN3c
 rVPxuNSybGk29mHR11eTEbszmFe4DApIJ2qAtu+Bzg1IKC3r69C5h9jY2yfgAifX7ArJnIsF6
 ffJbrwDHC1NW0ViP4a5MPyI73E++XiXgeAzqjSl5eChf6vX58flmq4a9Lxnzjgwpd8X7342Ey
 LypRw6ecP3Xv1rZC5eRNdHjWfUNXSRlku33SaVXScw0DQNGnf8XMTdM5eHPmzF5ZQMJjydtx1
 zjp4W1KHrQgNp6Z0gKBEIbKVUhy5/+OP4w7DzYFUWHIa2aZBjjCK1lFg95DmjpcAxFXLTGNHo
 OUp2Bvo3vE5bW88WJ0yEEr/TjW6CYEPsWPlRFGhoxNV5IjmB3KUzODixvkQ1tv1Zq3+LxQsOo
 Fl+brpvSybjmejFqSI/W51RHtwzpP0OSd8bj9yxeAAdEKpy1401L4O7jsQlfM1GxeM0ib257Y
 CP/+VGTlbW1cBWVi0JpYTeC3kTTXUAUEiWubJUYjud65yPTcdbayjIDyHibN0cK7fqWnNE0Ak
 WopkJiCpYSwA7mYE9ppyAOtsnzkYcsimfxpSsiglQ8WpGDWiW+2xKnxivlJGuC7rjN9kW5HnF
 3wushlnK7WsZPckv6g+JHbmovssE5C4w9YLQ4sW3P9cCUpKnf5QEBZRKwScTDq7k3KhrAfCOC
 N46lsuNIDIcICzX7fO0PtruxKF3ayDGxBOeUIIDpKhPcxTDQ+UYm4BSlIwUVylSDQ5Lqh6T6O
 2UjtvAEhtvR6OzQvAGl2mWKts3hN/Aakug7kptWkCZ3SBFrQggHGlxDbBot0B4QK1+onjb7gb
 Lku0hL4cctFtJzP/XjtsPKNWIVPMWfmN3Ls
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 212.227.15.14
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
Cc: Gemini Lasswell <gazally@HIDDEN>
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: -2.4 (--)


Hi,

sometimes it takes 10 or 20 seconds until the debugger pops up.  I
debugged code using widgets (who are complicated long lists).  But both
the number of frames and the length of the printed lists were not
exorbitant - a quite normal situation.

When I revert

e09120d68694272ea5efbe13b16936b4382389d8
Add backtrace-mode and use it in the debugger, ERT and Edebug

the debugger becomes fast again and pops up in a reasonable time.  With
the commit, the debugger is quite unusable in some cases: stepping
(`debugger-step-through') takes ten seconds per hit etc.  Not good.

FWIW, I think I very much appreciate the cited commit - I didn't yet
make use of the added features but it seems to be cool.  I hope we can
find a solution here.  At least there should be a way to get a faster
behavior.  BTW, I used the profiler and found that most of the time is
spent while garbage collecting.  My first thought was that cl-print may
be the culprit but that doesn't seem to be the case.

TIA,

Michael.






Acknowledgement sent to Michael Heerdegen <michael_heerdegen@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#36566; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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