From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Pittman Newsgroups: gmane.emacs.devel Subject: Re: Slow image display over network Date: Fri, 24 Sep 2010 11:47:26 +1000 Message-ID: <87iq1v6hg1.fsf@rimspace.net> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1285293139 28083 80.91.229.12 (24 Sep 2010 01:52:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 24 Sep 2010 01:52:19 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 24 03:52:18 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 1OyxST-0000HG-A7 for ged-emacs-devel@m.gmane.org; Fri, 24 Sep 2010 03:52:17 +0200 Original-Received: from localhost ([127.0.0.1]:43116 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyxSS-0007Fw-LP for ged-emacs-devel@m.gmane.org; Thu, 23 Sep 2010 21:52:16 -0400 Original-Received: from [140.186.70.92] (port=60767 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyxSJ-0007Dr-Vl for emacs-devel@gnu.org; Thu, 23 Sep 2010 21:52:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyxSF-00045m-Lh for emacs-devel@gnu.org; Thu, 23 Sep 2010 21:52:07 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:57749) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyxSF-00045E-AH for emacs-devel@gnu.org; Thu, 23 Sep 2010 21:52:03 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OyxSA-0000BV-JH for emacs-devel@gnu.org; Fri, 24 Sep 2010 03:51:58 +0200 Original-Received: from ppp59-167-189-244.static.internode.on.net ([59.167.189.244]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 Sep 2010 03:51:58 +0200 Original-Received: from daniel by ppp59-167-189-244.static.internode.on.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 Sep 2010 03:51:58 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 55 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: ppp59-167-189-244.static.internode.on.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:eytQwM3sBfjUZX5nrNQBb4kbJpI= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:130722 Archived-At: 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. ...during which, I bet, the image is pushed into the X server over that thin link, taking a 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. ...which works by telling the remote server "draw this image here", without having to ship any bits of image content, only send the draw instruction and details about which remote image object to source the data from. > 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? Well, I bet that it is actually the X side, and the Emacs implementation uses that, but... > To me it seems like there might be a lot of ping-pong network chatter > when Emacs is instantiating pictures the first time. ... you should be able to verify that with code inspection, or by checking the X related network traffic. Aw, heck. I saved you the time: PNG loading does create the X image and pixmap during the load process, confirming my guesswork. I didn't check the other image loaders, but they would sensibly behave the same way, showing the same result. Daniel -- ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons