emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Slow image display over network


From: Daniel Pittman
Subject: Re: Slow image display over network
Date: Fri, 24 Sep 2010 11:47:26 +1000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Lars Magne Ingebrigtsen <address@hidden> 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            ✉ address@hidden            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons




reply via email to

[Prev in Thread] Current Thread [Next in Thread]