From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel Newsgroups: gmane.emacs.bugs Subject: bug#21028: Performance regression in revision af1a69f4d17a482c359d98c00ef86fac835b5fac (Apr 2014). Date: Sat, 18 Jul 2015 04:16:16 -0700 Message-ID: <55AA3580.7040905@live.com> References: <559F9FAF.8090708@live.com> <83egkgb2wo.fsf@gnu.org> <559FF8F6.2060209@live.com> <55A652E4.5000606@yandex.ru> <55AA2942.8070706@live.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k44d3qhURRV3mLtkwCwOOMAldhNFiTxSb" X-Trace: ger.gmane.org 1437218242 5735 80.91.229.3 (18 Jul 2015 11:17:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 Jul 2015 11:17:22 +0000 (UTC) Cc: 21028@debbugs.gnu.org To: Dmitry Antipov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jul 18 13:17:12 2015 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 1ZGQ7C-0005k5-Tm for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Jul 2015 13:17:11 +0200 Original-Received: from localhost ([::1]:47930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGQ7B-000629-VY for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Jul 2015 07:17:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35089) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGQ77-000616-Pu for bug-gnu-emacs@gnu.org; Sat, 18 Jul 2015 07:17:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZGQ74-0001Ll-IC for bug-gnu-emacs@gnu.org; Sat, 18 Jul 2015 07:17:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51132) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGQ74-0001Lh-F4 for bug-gnu-emacs@gnu.org; Sat, 18 Jul 2015 07:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZGQ73-0005uf-VI for bug-gnu-emacs@gnu.org; Sat, 18 Jul 2015 07:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Jul 2015 11:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21028 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21028-submit@debbugs.gnu.org id=B21028.143721819222689 (code B ref 21028); Sat, 18 Jul 2015 11:17:01 +0000 Original-Received: (at 21028) by debbugs.gnu.org; 18 Jul 2015 11:16:32 +0000 Original-Received: from localhost ([127.0.0.1]:52578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGQ6Z-0005ts-CR for submit@debbugs.gnu.org; Sat, 18 Jul 2015 07:16:31 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.187]:63625) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGQ6W-0005tc-Cs for 21028@debbugs.gnu.org; Sat, 18 Jul 2015 07:16:29 -0400 Original-Received: from [172.20.14.53] ([12.10.78.5]) by mrelayeu.kundenserver.de (mreue005) with ESMTPSA (Nemesis) id 0Mczwc-1ZXXXt415e-00ICob; Sat, 18 Jul 2015 13:16:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <55AA2942.8070706@live.com> X-Provags-ID: V03:K0:epZUV0uM63cZ2R/Ligi81FI8YwsmNCtkgR87JFUK1jy96ZPCLX7 w/CuybEuqOPxLBv/FsyVOe9Ty1Vwf6fh7xhfcLGSbJOUQfmc6RNL/T34JR4UpxuAbfEnNAq QsDsMc+XQVlbVBn1Y65ANmmEXmqnISLF+vPfA8eP2DfKBj710UO5K/+ofo6jYHxdGgptirn ECHh9wSEk+BTLvG80I1Sw== X-UI-Out-Filterresults: notjunk:1;V01:K0:t8jNX1BEPWY=:fkIwTYaKX9iPDEKbOGluZh WPhttXmOHkz2jnJliI0R8scin7lEHmbK8/k2ZFydBj9/vFYmFIRELlLIjYQoRKXrdYatTI8Fk cJEnC7sn+nVfPSuZk/mpwaBN6v8RUmVfM55GoLw7TaqrgEuNnEBXYAZnHlJulDC2BumyZOpXh wAPG3Hb0r6rAIhUvWCr2lR+LdSyQ9XZZbprT0/5fVjFQZK+9NU/j7jwuLDQy+FLkDz28MkSDt Ap8pOZAtO+lMLJ1gAsXCKNo5OtEHjuw2vdLaDZZEP/i6xFDnfDw2uzyTHaTchaAemAe0TLnh7 0Dv8fxJcPvPKGNnaPnaUgK6TtJgXVANeS2/3Je8hLrztDKmNrpnCsZ6EjywcSmyz6gKDQx6YY vQiH9C4vLFOJuGCx8aUsKIMRUXPZ2h4EZhJu6DFljwZEplBghgRjNdcSs2GxnjycK8wXT2VFI t1x25kveldGE9Cxgxc0EWrfmMATk/xve95ZnuhM9roZQjfb+1zMbZ0LXkjVDwrK1mB9itQpC5 D5bchlCxcegUCtAxywWJaQpb5cF8oEk42KG0a1WU0LtwMclaILVXAJN+OnFELl97BrIym9K5m 0LZA3eUJuW9ru2rYjt6LZKfk4W1Gc+OLSY4D27Ogvi7cQ/FU4p7lpPeDnkTbM1kQ0KVrsigFa k2JQg1lQu12qTsMmO8y+EfThh X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:105021 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --k44d3qhURRV3mLtkwCwOOMAldhNFiTxSb Content-Type: multipart/mixed; boundary="------------000200010101000804020200" This is a multi-part message in MIME format. --------------000200010101000804020200 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi all, I've spent a bit more time looking into this. The problem is due to the f= ollowing three lines being conditioned on `!NILP(val)`: (that's around li= ne 2780 of src/font.c) Lisp_Object copy =3D copy_font_spec (scratch_font_spec); ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); Before af1a69f, these lines were always run. In af1a69f, they only run if= `val` is non nil, causing the regression: on master, moving them back ou= t of the if statement fixes the problem. For clarity I have attached the = corresponding patch. Cl=C3=A9ment. On 07/18/2015 03:24 AM, Cl=C3=A9ment Pit--Claudel wrote: > On 07/15/2015 05:32 AM, Dmitry Antipov wrote: >> On 07/10/2015 07:55 PM, Cl=C3=A9ment Pit--Claudel wrote: >> >>> The figures are very similar to the tests above: with that patch inse= rting 50 lines takes 3 seconds, >>> and without it it's instantaneous. Thus I think it's safe to say that= this particular patch is indeed >>> responsible for the performance regression. But maybe I'm missing som= ething? >> >> As of c40ea1328bb33abaec14f1fc92ac2349b5ee2715, I can't reproduce this= issue, with your fontset setup >> from http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D21028#17. Cursor m= otion and keyboard/mouse selection >> are smooth, and CPU/memory usage looks normal. >=20 > Thanks for trying this out. Thanks for your suggestions, too. >=20 >> My suggestions are: >> >> 1) Re-run your timed tests from http://debbugs.gnu.org/cgi/bugreport.c= gi?bug=3D21028#20 under /usr/bin/time, >> not time (the latter is a simple shell builtin). /usr/bin/time also sh= ows memory usage; if "bad" (current) >> instance consumes more memory than "good" (with reverted change) one, = there may be nasty GC issue. >=20 > The timings are similar: >=20 > $ /usr/bin/time emacs-bad/src/emacs -Q --eval "(progn (dotimes (_ 3) (s= et-fontset-font t 'unicode (font-spec :name \"Arial\") nil 'append)) (dot= imes (_ 500) (insert \"=E6=97=A5=E6=9C=AC=E5=9B=BD\n\")) (dotimes (_ 500)= (previous-line) (redisplay t)) (kill-emacs))" > 13.31user 8.57system 0:34.54elapsed 63%CPU (0avgtext+0avgdata 50592maxr= esident)k > 0inputs+0outputs (0major+4958minor)pagefaults 0swaps >=20 > $ /usr/bin/time emacs-good/src/emacs -Q --eval "(progn (dotimes (_ 3) (= set-fontset-font t 'unicode (font-spec :name \"Arial\") nil 'append)) (do= times (_ 500) (insert \"=E6=97=A5=E6=9C=AC=E5=9B=BD\n\")) (dotimes (_ 500= ) (previous-line) (redisplay t)) (kill-emacs))" > 0.58user 0.03system 0:01.05elapsed 58%CPU (0avgtext+0avgdata 50392maxre= sident)k > 29840inputs+0outputs (105major+4911minor)pagefaults 0swaps >=20 >> 2) 3 seconds is large enough to leave the traces in profiled runs. On = GNU/Linux, it may be worth trying >> to run under perf, both "good" and "bad" cases, and comparing reports.= >=20 > I have attached the reports in the good and bad cases (200c532 and af1a= 69f respectively). I'm not sure what to conclude from them; I can provide= the full trace data if needed. >=20 > Cl=C3=A9ment. >=20 --------------000200010101000804020200 Content-Type: text/x-diff; name="0001-Draft-of-a-fix-for-21028.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Draft-of-a-fix-for-21028.patch" =46rom c0c58994b1aa78289884525e4e3ae8b8e64d0c08 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Cl=3DC3=3DA9ment=3D20Pit--Claudel?=3D Date: Sat, 18 Jul 2015 04:13:07 -0700 Subject: [PATCH] Draft of a fix for #21028 --- src/font.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/font.c b/src/font.c index 50b966e..5cdde71 100644 --- a/src/font.c +++ b/src/font.c @@ -2779,12 +2779,12 @@ font_list_entities (struct frame *f, Lisp_Object = spec) val =3D driver_list->driver->list (f, scratch_font_spec); if (!NILP (val)) { - Lisp_Object copy =3D copy_font_spec (scratch_font_spec); - val =3D Fvconcat (1, &val); - ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); - XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); } + + Lisp_Object copy =3D copy_font_spec (scratch_font_spec); + ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); + XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); } if (VECTORP (val) && ASIZE (val) > 0 && (need_filtering --=20 2.4.6 --------------000200010101000804020200-- --k44d3qhURRV3mLtkwCwOOMAldhNFiTxSb Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJVqjWBAAoJEPqg+cTm90wjhp8P/R+0iDMKDIfJ9J3ATrYc/ack hWeFjgYqppAklIqR4x81R+DYa4ozALvHgzWAhtMc4jw0Xjdna3Rs0n0Yg4yYoYQx 8IyGZCq/QZYK1z3SGPrkbZvTaQ8/JLpVgPXkDULfUm4LxwSg56RUq6AClrhA49Ff pSq6sDjm8IN0qzoKEzTjhYDbcHT5ZNIfMWmNP+d4N3JGNLLobxwhMqjLBEBbDAC+ xxwcEZvkDGe0RqpvwxYEpGwEJjL+/MGFBHsLXovSscsoLuMvam819Qzp/9cywx5j 3wDJM+rXSS/colRneK6LlOPV3Vap6D4A9q1uGmpx+wPBzdhRDIfB6NpoA2mEaaMu +xduAqpvRA6mQTNIxW/tP/xewGi2mk4MViwMInpCCq/aHRFdPWgDFrfzUETVZ5vI v1vzBpE0MQHSBhUGLETmKceblWXnK8z07E3VJAzP8QJcITOMBqY4/DDLg1ONIYAz 15zhke0M41ZNf2MC3cDtXRA/1CuwJUcyFYErAgdh0vva+SpOtFqhm4uxZL2mNyVy YOEj0HEHrLH6m4axNDy0zb2eZvRcWo+rzxSqAiQrpOtXCKu+rHfye/mBjM1Hzuro tkbbTrBCDKkGOm7/Eg+Z1ms697AHX1Tp0RjACInQObKZulvEGDyYHu6wJU6pWpV3 BeGsPyD4V6SStGg1SH01 =Fhog -----END PGP SIGNATURE----- --k44d3qhURRV3mLtkwCwOOMAldhNFiTxSb--