[Top][All Lists]

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

X-windows performance over slow connections.

From: Bill Zaumen
Subject: X-windows performance over slow connections.
Date: Thu, 18 Jan 2007 15:35:54 -0800

This is really more of a feature request than a bug report.
emacs 21.4.1 (i486-pc-lunux-gnu, X toolkit, Xaw3d scroll bars)
and built on 2006-06-17.  I'm running ubuntu 6.06.

When I run ssh -C -X to connect to my home system over an ADSL
connection (unfortunately, in the 'slow' direction), it takes
well over a minute to start emacs.  I suspect this is due to the
menu, toolbar, scrollbars, and other X-windows features it uses.
Compression helps slightly, but is not quite enough.  I tried
to fix the problem by defining an environment variable named
EMACS_NET_PROFILE which, if defined, has the value "slow", "medium"
or "fast" to denote the speed of one's connection.  For slower
connections, it then turns off scroll bars, tool tips, menus, and
the tool bar based on the value of this variable.  Functionally,
this works as one would expect, however over a slow connection, I
can see the tool bar appear and then eventually go away: it seems
that the tool bar is created before my .emacs file is read, so
emacs takes about as long as before to get started.

It would be useful if one could use the environment variable I
defined or some other mechanism to suppress these features for
low bandwidth connections so that emacs starts faster.
You can set up SSH to pass particular environment variables so you 
could type something like

        EMACS_NET_PROFILE=slow ssh -C -X foo.net

and then just start emacs on foo.net, so that the normal keyboard
mappings work (e..g, the use of the ALT key as a META key on PC
keyboards).  This avoids the need to use special command-line options
(e.g., when emacs is started from a script).

I've enclosed the LISP code below - it is adequate for functional
testing but does not seem to be called early enough.


;;; When run remotely (e.g., via ssh -X) on a slow link such as
;;; a home ADSL link accessing the home machine from the Internet,
;;; emacs takes a long time to start up - over a minute.  The
;;; slow starting time is due primarily to X windows.  The
;;; function adapt-to-network-speed attempts to turn off emacs
;;; facilities that are nice to have but expensive to run on
;;; very slow network connections. It uses an environment
;;; variable EMACS_NET_PROFILE to determine the type of connection.
;;; There is no attempt to adapt to current network conditions,
;;; but rather a classification as to the type of network
;;; connection is made on the basis of the best-case or typical-case
;;; performance one can get, and as a result a statically determined
;;; value can be used.  These values are
;;;   "slow" - typical of dialup or ADSL in the 'slow' direction.
;;;   "medium" - perhaps 300 Kbits/sec in either direction.
;;;   "fast" - one Megabit per second or higher.
;;; It is possible to configure SSH to pass environment variables
;;; and this can defined in a configuration file.  The server will,
;;; however, have to be configured to accept the variables one wants
;;; to use.  See the manual pages for ssh_config and sshd_config.

(defun adapt-to-network-speed ()
  "Reads the environment variable EMACS_NET_PROFILE, whose values
are 'slow', 'medium', and 'fast', and configures emacs appropriately.
Intended to be called when emacs starts up with the environment variable
set on the basis of the type of network connection."

  (let ((speed (getenv "EMACS_NET_PROFILE")))
    (if speed
        (cond ((equal speed "slow")
               (scroll-bar-mode -1)
               (tool-bar-mode 0)
               (tooltip-mode 0)
               (menu-bar-mode 0))
              ((equal speed "medium")
               (tool-bar-mode 0))
              ((equal speed "fast") t)
                "Illegal value for environment variable EMACS_NET_PROFILE"

reply via email to

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