From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?J=C3=B6rg?= Walter Newsgroups: gmane.emacs.bugs Subject: bug#12463: 24.2; pos-visible-in-window-p gets slower over time Date: Tue, 18 Sep 2012 18:18:56 +0200 Organization: Syntax-K Message-ID: <4023344.MyoQPQRfcJ@queen> References: <87wqzs1a4c.fsf@queen.i-did-not-set--mail-host-address--so-tickle-me> <83mx0n22p0.fsf@gnu.org> <87d31jcqce.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart4489839.oiHcif47Kq" Content-Transfer-Encoding: 7Bit X-Trace: ger.gmane.org 1347985202 19937 80.91.229.3 (18 Sep 2012 16:20:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Sep 2012 16:20:02 +0000 (UTC) To: 12463@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 18 18:20:07 2012 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 1TE0Wm-0002Nt-To for geb-bug-gnu-emacs@m.gmane.org; Tue, 18 Sep 2012 18:20:01 +0200 Original-Received: from localhost ([::1]:33526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TE0Wi-0001nZ-Mk for geb-bug-gnu-emacs@m.gmane.org; Tue, 18 Sep 2012 12:19:56 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51170) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TE0We-0001nN-Mt for bug-gnu-emacs@gnu.org; Tue, 18 Sep 2012 12:19:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TE0WU-00044B-7c for bug-gnu-emacs@gnu.org; Tue, 18 Sep 2012 12:19:52 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TE0WU-000443-4j for bug-gnu-emacs@gnu.org; Tue, 18 Sep 2012 12:19:42 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TE0Xm-0005VO-5f for bug-gnu-emacs@gnu.org; Tue, 18 Sep 2012 12:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?J=C3=B6rg?= Walter Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 18 Sep 2012 16:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12463 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12463-submit@debbugs.gnu.org id=B12463.134798523221057 (code B ref 12463); Tue, 18 Sep 2012 16:21:02 +0000 Original-Received: (at 12463) by debbugs.gnu.org; 18 Sep 2012 16:20:32 +0000 Original-Received: from localhost ([127.0.0.1]:42025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TE0XI-0005TZ-Dm for submit@debbugs.gnu.org; Tue, 18 Sep 2012 12:20:32 -0400 Original-Received: from selda.webserv-it.de ([91.211.43.170]:32932 helo=mercenary.garni.ch) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TE0XF-0005TJ-QJ for 12463@debbugs.gnu.org; Tue, 18 Sep 2012 12:20:31 -0400 Original-Received: from 77-22-152-244-dynip.superkabel.de ([77.22.152.244] helo=queen.localnet) by mercenary.garni.ch with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1TE0Vt-0005im-Ma for 12463@debbugs.gnu.org; Tue, 18 Sep 2012 18:19:08 +0200 User-Agent: KMail/4.8.4 (Linux/3.2.0-23-lowlatency; KDE/4.8.4; x86_64; ; ) In-Reply-To: <87d31jcqce.fsf@gnu.org> X-SA-Exim-Connect-IP: 77.22.152.244 X-SA-Exim-Mail-From: jwalt@garni.ch X-SA-Exim-Version: 4.2.1 (built Sat, 07 Nov 2009 20:03:47 +0000) X-SA-Exim-Scanned: Yes (on mercenary.garni.ch) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:64558 Archived-At: --nextPart4489839.oiHcif47Kq Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" Op den Dingsdag, de 18. September 2012 Klock 23:17:53 hett Chong Yidong= =20 schreven: > Eli Zaretskii writes: > > Can anyone else reproduce this? >=20 > I can reproduce this. On bisecting, the problem first shows up with >=20 > revno: 104186 > fixes bug: http://debbugs.gnu.org/8640 > committer: Juanma Barranquero > branch nick: trunk > timestamp: Tue 2011-05-10 12:31:33 +0200 > message: > src/image.c (Finit_image_library): Return t for built-in image type= s. >=20 > A quick glance at the diff of this revision does not reveal immediate= ly > why it causes the problem, though. I have no idea why that revision triggers the bug either, but here is a= patch=20 that fixes the problem. I have no idea if it matches your quality stand= ards,=20 but I think it is clean enough. I've reused and adapted some code alrea= dy=20 present for Win32 (which is the reason they don't suffer the same probl= em). The linked list `image_types' grows without bounds because=20 CHECK_LIB_AVAILABLE/define_image_type never checked if the given image = type is=20 already in `image_types'. My lisp code triggered tons of `Finit_image_l= ibrary'=20 calls. Since the list is searched linearly at some point, that explains= the=20 run-time impact. I have no idea what was originally supposed to ensure `image_types' doe= sn't=20 include duplicate entries, so the patch may be way off... hope someone = actually=20 knows what is suppsed to go on there. --=20 CU =09J=F6rg --nextPart4489839.oiHcif47Kq Content-Disposition: attachment; filename="emacs-image-bug.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="emacs-image-bug.patch" --- image.c 2012-09-18 18:10:21.952695267 +0200 +++ image.c.new 2012-09-18 18:09:18.173692841 +0200 @@ -575,12 +575,11 @@ static void x_emboss (struct frame *, struct image *); static int x_build_heuristic_mask (struct frame *, struct image *, Lisp_Object); -#ifdef HAVE_NTGUI + +static Lisp_Object loaded_image_types; + #define CACHE_IMAGE_TYPE(type, status) \ - do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0) -#else -#define CACHE_IMAGE_TYPE(type, status) -#endif + do { loaded_image_types = Fcons (Fcons (type, status), loaded_image_types); } while (0) #define ADD_IMAGE_TYPE(type) \ do { Vimage_types = Fcons (type, Vimage_types); } while (0) @@ -8743,12 +8742,10 @@ of `dynamic-library-alist', which see). */) (Lisp_Object type, Lisp_Object libraries) { -#ifdef HAVE_NTGUI /* Don't try to reload the library. */ - Lisp_Object tested = Fassq (type, Vlibrary_cache); + Lisp_Object tested = Fassq (type, loaded_image_types); if (CONSP (tested)) return XCDR (tested); -#endif /* Types pbm and xbm are built-in and always available. */ if (EQ (type, Qpbm) || EQ (type, Qxbm)) @@ -8828,6 +8825,9 @@ non-numeric, there is no explicit limit on the size of images. */); Vmax_image_size = make_float (MAX_IMAGE_SIZE); + loaded_image_types = Qnil; + staticpro(&loaded_image_types); + DEFSYM (Qpbm, "pbm"); ADD_IMAGE_TYPE (Qpbm); --nextPart4489839.oiHcif47Kq--