From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: Redisplay slower in Emacs 28 than Emacs 27 Date: Mon, 7 Dec 2020 22:23:35 +0000 Message-ID: References: <877dptfvae.fsf@gnus.org> <83czzl8qwu.fsf@gnu.org> <87sg8h78s8.fsf@gnus.org> <87h7ox71xc.fsf@gnus.org> <874kkx6zwj.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28427"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Gregory Heytings , Eli Zaretskii , emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 07 23:25:32 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kmOwm-0007IQ-99 for ged-emacs-devel@m.gmane-mx.org; Mon, 07 Dec 2020 23:25:32 +0100 Original-Received: from localhost ([::1]:37718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmOwl-00076z-77 for ged-emacs-devel@m.gmane-mx.org; Mon, 07 Dec 2020 17:25:31 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmOv4-0006AG-0O for emacs-devel@gnu.org; Mon, 07 Dec 2020 17:23:46 -0500 Original-Received: from outbound.soverin.net ([2a01:4f8:fff0:2d:8::218]:59453) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmOv1-0006B7-7M; Mon, 07 Dec 2020 17:23:45 -0500 Original-Received: from smtp.soverin.net (unknown [10.10.3.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 615F06008F; Mon, 7 Dec 2020 22:23:39 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.138]) by soverin.net Original-Received: by breton.holly.idiocy.org (Postfix, from userid 501) id E145B202866FBB; Mon, 7 Dec 2020 22:23:35 +0000 (GMT) Mail-Followup-To: Alan Third , Lars Ingebrigtsen , Gregory Heytings , Eli Zaretskii , emacs-devel@gnu.org Content-Disposition: inline In-Reply-To: <874kkx6zwj.fsf@gnus.org> Received-SPF: pass client-ip=2a01:4f8:fff0:2d:8::218; envelope-from=alan@idiocy.org; helo=outbound.soverin.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:260530 Archived-At: On Mon, Dec 07, 2020 at 10:59:24PM +0100, Lars Ingebrigtsen wrote: > And this is the culprit -- i.e., this is what's busting the cache, as > far as I can tell: > > (defun tool-bar--image-expression (icon) > "Return an expression that evaluates to an image spec for ICON." > (let* ((fg (face-attribute 'tool-bar :foreground)) > (bg (face-attribute 'tool-bar :background)) > (colors (nconc (if (eq fg 'unspecified) nil (list :foreground fg)) > (if (eq bg 'unspecified) nil (list :background bg)))) > (xpm-spec (list :type 'xpm :file (concat icon ".xpm"))) > (xpm-lo-spec (list :type 'xpm :file > (concat "low-color/" icon ".xpm"))) > (pbm-spec (append (list :type 'pbm :file > (concat icon ".pbm")) colors)) > (xbm-spec (append (list :type 'xbm :file > (concat icon ".xbm")) colors))) > `(find-image (cond ((not (display-color-p)) > ',(list pbm-spec xbm-spec xpm-lo-spec xpm-spec)) > ((< (display-color-cells) 256) > ',(list xpm-lo-spec xpm-spec pbm-spec xbm-spec)) > (t > ',(list xpm-spec pbm-spec xbm-spec)))))) > > Whenever Emacs is asked to redisplay the toolbar, Emacs will run this > function? That's what my instrumentation seems to say... > > I don't use toolbars normally, so I'm not sure how they're supposed to > work -- but shouldn't this toolbar data be computed only once, instead > of repeatedly? I think the image cache is actually broken. If we have two image specs that have the same contents, but don't have identical memory locations, surely we still want the cache to work? For example when playing an animated gif image.el doesn't store the image specs for each frame, it generates them on the fly by incrementing the frame counter. I can see that Emacs creates a new cache entry for every frame every time the gif is played through. That means it must be decoding every frame every time. -- Alan Third