From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Aaron Jensen Newsgroups: gmane.emacs.bugs Subject: bug#23928: 25.0.95; Performance regression observable with smartparens Date: Sun, 10 Jul 2016 15:58:58 +0000 Message-ID: References: <83wpkug2zs.fsf@gnu.org> <83h9bxftx4.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11449100a9071b05374a1de3 X-Trace: ger.gmane.org 1468166473 6120 80.91.229.3 (10 Jul 2016 16:01:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Jul 2016 16:01:13 +0000 (UTC) Cc: npostavs@users.sourceforge.net, 23928@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 10 18:01:05 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bMHAG-0003qd-9T for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Jul 2016 18:01:04 +0200 Original-Received: from localhost ([::1]:55723 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMHAC-0005ja-53 for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Jul 2016 12:01:00 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMH9K-0004NZ-7j for bug-gnu-emacs@gnu.org; Sun, 10 Jul 2016 12:00:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bMH9H-0004n1-2E for bug-gnu-emacs@gnu.org; Sun, 10 Jul 2016 12:00:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33005) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMH9G-0004mv-Ue for bug-gnu-emacs@gnu.org; Sun, 10 Jul 2016 12:00:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bMH9G-0005WN-Ok for bug-gnu-emacs@gnu.org; Sun, 10 Jul 2016 12:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Aaron Jensen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Jul 2016 16:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23928 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 23928-submit@debbugs.gnu.org id=B23928.146816635621142 (code B ref 23928); Sun, 10 Jul 2016 16:00:02 +0000 Original-Received: (at 23928) by debbugs.gnu.org; 10 Jul 2016 15:59:16 +0000 Original-Received: from localhost ([127.0.0.1]:45342 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMH8V-0005Uw-Og for submit@debbugs.gnu.org; Sun, 10 Jul 2016 11:59:16 -0400 Original-Received: from mail-io0-f182.google.com ([209.85.223.182]:33291) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMH8T-0005Uj-SE for 23928@debbugs.gnu.org; Sun, 10 Jul 2016 11:59:14 -0400 Original-Received: by mail-io0-f182.google.com with SMTP id t74so81051367ioi.0 for <23928@debbugs.gnu.org>; Sun, 10 Jul 2016 08:59:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+W8V7RkBvn1CbWEvoLG6oerFBr0zA+Jr6cFhXCTxAFg=; b=iQg/gyX4zuwUI6TDg17g5YerpVyx6Pwv4nDJzxSuP8Eat9irhpqjBn+3tGESEk7TkA HpNFfO3sAzJREgAgMpdio0yCYP14xKYS5krmaFM6Uci6yLDmpRKu1TaXrbQgOkvPsQ2E 7xo8P8K/ka3Y/ln/iOEKWOvt024CRYz5eB+N6fspu5agZkLm1j+i1oPFVRZVhNuIgvCR HC3caUP3yW9ueuwXWctcSd70fsP/Ywkhs/zrYJhoKmxlK27XnaMpJEpNrjD1bVlaTysz yCfC3NpjGvjTB7GCs91yjL2AcEmMQA60drcFeJ7SiITQvIvPV8w85fT9H9KssQ5d80KS 2vVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+W8V7RkBvn1CbWEvoLG6oerFBr0zA+Jr6cFhXCTxAFg=; b=QFSNiEXS6ahXCg0yg1T1NCyHKEOnGMAAJJE8JPXHVbfNnJzPmNkqsVDQODU69VeHL6 Hv6cmawNk0sNwJPVSu+1f+OBkG+d+iAyE51KWM7xTVc4Yd8/Id6G4M3BcBnm3jjBMfEw rPoXwPyfnRuwhEfdAmVl3JSI3QoN/vzxBF2gBp+ZxUxkVCojCra3VwIheydCM/nryUNh t52xzFqLNfmP3c3HpZ6F9TALj47vXXHxNZvT5+YX7/23uAFuvSGaf1v/HHcraP/OzaFm /oScV+GChFrolJJQIqQviE9MazlERBSXndzGVpZbg1XumHmIA32BY+T6mMEifGNTEmx7 4jpA== X-Gm-Message-State: ALyK8tKo5BnUCPYco2i9Fn+KkTU4U+4k0VAGXAPVt404e0ianUA+lZHicj4i1TYZ77irhrVCXeDDgtl8JsMoRQ== X-Received: by 10.107.175.1 with SMTP id y1mr16228734ioe.137.1468166348275; Sun, 10 Jul 2016 08:59:08 -0700 (PDT) In-Reply-To: <83h9bxftx4.fsf@gnu.org> 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: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:120765 Archived-At: --001a11449100a9071b05374a1de3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sun, Jul 10, 2016 at 7:30 AM Eli Zaretskii wrote: > Thanks. > > That rings a bell. The hottest function on these profiles is > sp--looking-back, which calls in a loop sp--looking-at, which does > this: > > (defun sp--looking-at (regexp) > "Like `looking-at', but always case sensitive." > (let ((case-fold-search nil)) > (looking-at regexp))) > > As you will see from bug#18522, binding case-fold-search can be very > expensive, especially if you have a lot of buffers. See > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D18522#201 for a summary > of the findings there. It clearly shows in your profile: > > sp--looking-at 171 12% > let 12 0% > > As to why you see a slowdown in Emacs 25, I don't know. Maybe you > have more buffers crop up there as the session goes on? > Interesting, yes this is possible. I switched to Emacs 25 before I started emacs itself heavily and using window configurations heavily, so it is very likely that I just end up with a large number of buffers and that=E2=80=99s= when the slowdown happens. What is the alternative to binding case-fold-search? Could smartparens just bind it once in a surrounding function? Or is there another way to ensure that `looking-at` is case sensitive? > > One curious thing is that the emacs 24 profile shows all of the builtin= s > (let/if/save-excusion) and the emacs 25 profile does not. Is there > something I=E2=80=99m doing wrong that is causing that? > > Could it be that in Emacs 24 you loaded the library as a .el file, and > in Emacs 25 as a .elc file? > I suppose this is possible, I had just started emacs 24 and let it install all from elpa/melpa (I=E2=80=99m using spacemacs, so it handled all this fo= r me). Typically it compiles everything, but maybe it hadn=E2=80=99t yet in the se= ssion I was running. I have confirmed that if I eval-buffer smartparens.el, I get the more detailed profile. That=E2=80=99s useful, thanks. > > I=E2=80=99ll work on this. It seems possible that it will be very hard = to track > down given the nature=E2=80=94the performance isn=E2=80=99t *always* bad,= it just becomes > bad at some point in the session. > > When it becomes bad, count the number of buffers in each session. > Bug#18522 provides some tools for that. > I couldn=E2=80=99t figure out how to count all_buffers, but I saw (length (buffer-list)), is that sufficient? --=20 Aaron --001a11449100a9071b05374a1de3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Sun, Jul 10, 2016 at 7:30 AM Eli Zaretskii <eliz@gnu.org> wrote:
Thanks.

That rings a bell.=C2=A0 The hottest function on these profiles is
sp--looking-back, which calls in a loop sp--looking-at, which does
this:

=C2=A0 (defun sp--looking-at (regexp)
=C2=A0 =C2=A0 "Like `looking-at', but always case sensitive."=
=C2=A0 =C2=A0 (let ((case-fold-search nil))
=C2=A0 =C2=A0 =C2=A0 (looking-at regexp)))

As you will see from bug#18522, binding case-fold-search can be very
expensive, especially if you have a lot of buffers.=C2=A0 See
http://debbugs.gnu.org/cgi/bugreport.cgi?bug= =3D18522#201 for a summary
of the findings there.=C2=A0 It clearly shows in your profile:

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sp--looking-a= t=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 171=C2=A0 12%
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 let=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A012=C2=A0 =C2=A00%

As to why you see a slowdown in Emacs 25, I don't know.=C2=A0 Maybe you=
have more buffers crop up there as the session goes on?

Interesting, yes this is possible. I switched to Emacs 25 = before I started emacs itself heavily and using window configurations heavi= ly, so it is very likely that I just end up with a large number of buffers = and that=E2=80=99s when the slowdown happens.

What= is the alternative to binding case-fold-search? Could smartparens just bin= d it once in a surrounding function? Or is there another way to ensure that= `looking-at` is case sensitive?


> One curious thing is that the emacs 24 profile shows all of the builti= ns (let/if/save-excusion) and the emacs 25 profile does not. Is there somet= hing I=E2=80=99m doing wrong that is causing that?

Could it be that in Emacs 24 you loaded the library as a .el file, and
in Emacs 25 as a .elc file?

I suppose t= his is possible, I had just started emacs 24 and let it install all from el= pa/melpa (I=E2=80=99m using spacemacs, so it handled all this for me). Typi= cally it compiles everything, but maybe it hadn=E2=80=99t yet in the sessio= n I was running. I have confirmed that if I eval-buffer smartparens.el, I g= et the more detailed profile. That=E2=80=99s useful, thanks.

=

> I=E2=80=99ll work on this. It seems possible that it will be very hard= to track down given the nature=E2=80=94the performance isn=E2=80=99t *alwa= ys* bad, it just becomes bad at some point in the session.

When it becomes bad, count the number of buffers in each session.
Bug#18522 provides some tools for that.

I couldn=E2=80=99t figure out how to count all_buffers, but I saw (length = (buffer-list)), is that sufficient?
--
Aaron
--001a11449100a9071b05374a1de3--