From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joakim@verona.se Newsgroups: gmane.emacs.devel Subject: Re: Slow image display over network Date: Fri, 24 Sep 2010 09:44:35 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1285314300 28386 80.91.229.12 (24 Sep 2010 07:45:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 24 Sep 2010 07:45:00 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 24 09:44:58 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz2xm-0001Yw-1E for ged-emacs-devel@m.gmane.org; Fri, 24 Sep 2010 09:44:58 +0200 Original-Received: from localhost ([127.0.0.1]:56757 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oz2xl-0004H3-DY for ged-emacs-devel@m.gmane.org; Fri, 24 Sep 2010 03:44:57 -0400 Original-Received: from [140.186.70.92] (port=41869 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oz2xc-0004Gy-Ob for emacs-devel@gnu.org; Fri, 24 Sep 2010 03:44:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oz2xY-0002Xz-BR for emacs-devel@gnu.org; Fri, 24 Sep 2010 03:44:48 -0400 Original-Received: from iwfs.imcode.com ([82.115.149.64]:52109 helo=gate.verona.se) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz2xX-0002TI-U4 for emacs-devel@gnu.org; Fri, 24 Sep 2010 03:44:44 -0400 Original-Received: from localhost.localdomain (IDENT:1005@localhost [127.0.0.1]) by gate.verona.se (8.13.4/8.11.4) with ESMTP id o8O7iZd2019140 for ; Fri, 24 Sep 2010 09:44:35 +0200 In-Reply-To: (Lars Magne Ingebrigtsen's message of "Fri, 24 Sep 2010 01:43:28 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:130730 Archived-At: I think most has been said in the other replies, but heres some random other thoughts(sorry for top-posting): - Try a compressed X implementation such as NX, and see how that compares. (My guess is that the initial image transfer will be a bit faster since NX can transfer pixmaps in compressed formats) - One of the TODO:s for the ImageMagick branch is to try to optimize display of images with low color-depth. I think several of the image loaders just allocates full RGB pixmaps even though a binary pixmap would be sufficient for a BW image for example. This optimization wouldnt help actual RGB images though. - It would be interesting to try out to optimize SVG support, for instance, by implementing it as vector drawing calls on the X display rather than, as now, drawing the SVG into a pixmap that then gets transmitted through the wire and cached in the X server. That seems like a lot of work though. Have fun playing around in the image code! /Joakim Lars Magne Ingebrigtsen writes: > One thing I've wondered about for a while, but has become more relevant > lately (what with the web feeds in Gnus and stuff) is why image display > is so slow over remote connections. > > Here's how to reproduce: > > 1) ssh somewhere that's far away, so that there's plenty of latency > 2) open an Emacs over X > 3) (put-image "/tmp/pretty-big-picture.jpg" (point)) > > Depending on how big the picture is, and what the latency is, this might > take very long time. > > 4) switch to a different buffer > > This will be instantaneous. > > 5) switch back to the buffer where the picture is > > This will not be instantaneous, but it will be very fast. > > So that's the behaviour I don't understand. The first time you display > an image (over a high-latency X connection), it's really slow. The next > time you display the same picture, it's really fast. > > Emacs caches pictures internally, but that doesn't really explain the > incredible slowness the first time the picture is displayed remotely. > Or does it? > > To me it seems like there might be a lot of ping-pong network chatter > when Emacs is instantiating pictures the first time. > > In fact, just calling this takes several seconds remotely: > > (image-size (create-image "/tmp/sleeve.jpg") t) > > But only the first time. > > Hm. Actually, `put-image' after the first `image-size' is > instantaneous. Which sort of confirms my suspicions -- it's not the > remote image display per se that is latency-sensitive, but something > Emacs does while instantiating it. > > Does anybody know what's causing this? Or where I should poke around? -- Joakim Verona