From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail
From: Noam Postavsky <npostavs@gmail.com>
Newsgroups: gmane.emacs.bugs
Subject: bug#36566: 27.0.50; debug is sometimes horribly slow
Date: Tue, 10 Sep 2019 22:54:07 -0400
Message-ID: <87v9tza6gg.fsf@gmail.com>
References: <87r26yvb4r.fsf@web.de> <871ryy2l1t.fsf@gmail.com>
 <87r26xjyon.fsf@web.de> <877e8llbzo.fsf@runbox.com>
 <8736ilaepu.fsf@runbox.com> <87h871u24i.fsf@gmail.com>
 <874l2vcrtn.fsf@runbox.com> <874l2eosa7.fsf@gmail.com>
 <87mufh8jj2.fsf@runbox.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226";
	logging-data="165255"; mail-complaints-to="usenet@blaine.gmane.org"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
Cc: Michael Heerdegen <michael_heerdegen@web.de>, 36566@debbugs.gnu.org,
 Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Gemini Lasswell <gazally@runbox.com>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 11 04:55:17 2019
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.89)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1i7smr-000goc-69
	for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 Sep 2019 04:55:17 +0200
Original-Received: from localhost ([::1]:46154 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1i7smj-0007Z1-QY
	for geb-bug-gnu-emacs@m.gmane.org; Tue, 10 Sep 2019 22:55:09 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36946)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1i7smd-0007Ys-AO
 for bug-gnu-emacs@gnu.org; Tue, 10 Sep 2019 22:55:04 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1i7smc-00034U-98
 for bug-gnu-emacs@gnu.org; Tue, 10 Sep 2019 22:55:03 -0400
Original-Received: from debbugs.gnu.org ([209.51.188.43]:33094)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1i7smc-00034O-5w
 for bug-gnu-emacs@gnu.org; Tue, 10 Sep 2019 22:55:02 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1i7smc-0004XS-1z
 for bug-gnu-emacs@gnu.org; Tue, 10 Sep 2019 22:55:02 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Noam Postavsky <npostavs@gmail.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Wed, 11 Sep 2019 02:55:01 +0000
Resent-Message-ID: <handler.36566.B36566.156817045717389@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 36566
X-GNU-PR-Package: emacs
Original-Received: via spool by 36566-submit@debbugs.gnu.org id=B36566.156817045717389
 (code B ref 36566); Wed, 11 Sep 2019 02:55:01 +0000
Original-Received: (at 36566) by debbugs.gnu.org; 11 Sep 2019 02:54:17 +0000
Original-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@debbugs.gnu.org>)
 id 1i7sls-0004WN-1b
 for submit@debbugs.gnu.org; Tue, 10 Sep 2019 22:54:17 -0400
Original-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@gmail.com>) id 1i7slq-0004WB-LG
 for 36566@debbugs.gnu.org; Tue, 10 Sep 2019 22:54:15 -0400
Original-Received: by mail-io1-f65.google.com with SMTP id d17so20523618ios.13
 for <36566@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)
Original-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)
In-Reply-To: <87mufh8jj2.fsf@runbox.com> (Gemini Lasswell's message of "Fri,
 06 Sep 2019 09:41:05 -0700")
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 209.51.188.43
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org
Original-Sender: "bug-gnu-emacs"
 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.emacs.bugs:166352
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/166352>

Gemini Lasswell <gazally@runbox.com> writes:

> Noam Postavsky <npostavs@gmail.com> 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.