home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / Other / Coherent / DemonArchives / docs / x.perf.faq.z / x.perf.faq
Encoding:
Text File  |  1993-09-08  |  28.4 KB  |  677 lines

  1. Archive-name: x-faq/speedups
  2. Last-modified: 1993/4/20
  3.  
  4. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  5.     HOW TO MAXIMIZE THE PERFORMANCE OF X -- monthly posting
  6. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  7.         Compiled by Art Mulder (art@cs.ualberta.ca)
  8.  
  9.   More RAM, Faster CPU's, More disk space, Faster Ethernet...  These
  10.   are the standard responses you hear when you ask how to improve the
  11.   performance of your workstation.
  12.  
  13.   Well, more hardware isn't always an option, and I wonder if more
  14.   hardware is always even a necessity.
  15.  
  16.   This "FAQ" list is a collection of suggestions and ideas from different
  17.   people on the net on how you can the best possible performance from X
  18.   Windows on your workstation, WITHOUT PURCHASING MORE HARDWARE.
  19.  
  20.   Performance is a highly subjective issue.  The individual user must
  21.   balance `speed' versus `features' in order to come to a personal
  22.   decision.  Therefore this document can be be expected to contain many
  23.   subjective opinions in and amongst the objective facts.
  24.  
  25.   This document is specifically concerned with X.  There are of course
  26.   many other factors that can affect the performance of a workstation.
  27.   However, they are outside the scope of this document.
  28.  
  29.     [ People seriously interested in the whole area of system
  30.     performance, might want to look at the O'Reilly Nutshell Handbook
  31.     "System Performance Tuning" by Mike Loukides.  IMHO, it contains a
  32.     well-written, comprehensive treatment of system performance.  I'm
  33.     unaware of any other similar books.  --ed.]
  34.  
  35. -----------------
  36. Table of Contents
  37. -----------------
  38.   0. Introduction & Administrivia
  39.   1. What about the "Other X FAQ"?
  40.   2. Window Managers
  41.   3. The X Server
  42.        Which Server?
  43.        Locking the Server into RAM?
  44.        Starting your Server
  45.        Fonts
  46.        About the Resources File
  47.        Define Your Display Properly
  48.   4. Clients
  49.        A Better Clock for X
  50.        A Better Terminal Emulator for X
  51.        Tuning your client
  52.   5. Miscellaneous Suggestions
  53.        Pretty Pictures
  54.        A Quicker Mouse
  55.        Programming Thoughts
  56.        Say What!?
  57.   6. Other Sources of Information
  58.   7. Author & Notes
  59.   
  60. ! = changed since last issue.
  61. * = new since last issue.
  62.  
  63. -----------------------------
  64. Introduction & Administrivia
  65. -----------------------------
  66.  
  67.   This document is posted each month, on or around the 15th, to the
  68.   Usenet news groups comp.windows.x, news.answers, and comp.answers.
  69.   If you are reading a copy of this FAQ which is more than a few
  70.   months old (see the "Last-modified" date above) you should probably
  71.   locate the latest edition, since the information may be outdated.
  72.  
  73.   If you do not know how to get those newsgroups and/or your site does
  74.   not receive them and/or this article has already expired, you can
  75.   retrieve this FAQ from an archive site.
  76.  
  77.   There exist several usenet FAQ archive sites.  To find out more about
  78.   them and how to access them, please see the "Introduction to the
  79.   news.answers newsgroup" posting in news.answers.
  80.  
  81.   The main FAQ archive is at rtfm.mit.edu.  This document can be found
  82.   there in /pub/usenet/news.answers/x-faq/speedups.  If you do not have
  83.   access to anonymous ftp, you can retrieve it by sending a mail
  84.   message to mail-server@rtfm.mit.edu with the command "send
  85.   usenet/news.answers/x-faq/speedups" in the message body.
  86.  
  87. -----------------------------
  88. What about the "Other X FAQ"?
  89. -----------------------------
  90.  
  91.   David B. Lewis (faq%craft@uunet.uu.net) maintains the informative and
  92.   well written "comp.windows.x Frequently Asked Questions" document.
  93.   Its focus is on general X information, while this FAQ concentrates
  94.   on performance.
  95.  
  96.   The comp.windows.x FAQ does address the issue of speed, but only with
  97.   regards to the X server.  The gist of that topic seems to be:
  98.     "Use X11R5, it is faster than R4".
  99.   (Please see the X FAQ for complete details).
  100.  
  101. ---------------
  102. Window Managers
  103. ---------------
  104.  
  105.   There are a lot of window managers out there, with lots of different
  106.   features and abilities.  The choice of which to use is by necessity a
  107.   balancing act between performance and useful features.  At this
  108.   point, most respondents have agreed upon "twm" as the best candidate
  109.   for a speedy window manager. 
  110.  
  111.   A couple of generic tricks you can try to soup up your window manger,
  112.   is turning off unnecessary things like "zooming" and "opaque move".
  113.   Also, if you lay out your windows in a tiled manner, you reduce the
  114.   amount of cpu power spent in raising and lowering overlapping
  115.   windows.                           Joe English (joe@trystero.art.com)
  116.  
  117.   I've found that a good font for tiling is 7x13 (aka:
  118.   -misc-fixed-medium-r-normal--13-100-100-100-c-70-iso8859-1 ). It is
  119.   the biggest font I know of that I can use on my Sun (1152x900 screen)
  120.   and still get two 80 column terminal windows side-by-side on the
  121.   display with no overlap.  Other font suggestions will be accepted.
  122.  
  123. ------------
  124. The X Server
  125. ------------
  126.  
  127. Which Server?
  128. - - - - - - -
  129.   Make sure that your server is a proper match for your hardware.
  130.   If you have a monochrome monitor, use a monochrome X11 server.
  131.  
  132.   On my Monochrome Sun, I haven't noticed much difference between
  133.   the Xsun (colour) server and XsunMono, however it was pointed out to
  134.   me that XsunMono is about 800k smaller and therefore should contribute
  135.   to less paging.  
  136.          [ thanks to: Jonny Farringdon (j.farringdon@psychol.ucl.ac.uk),
  137.                         Michael Salmon (Michael.Salmon@eos.ericsson.se) ]
  138.  
  139.   How your server was compiled can also make a difference.  Jeff Law
  140.   (law@schirf.cs.utah.edu) advises us that on a Sun system, X should be
  141.   compiled with gcc (version 2.*) or with the unbundled Sun compiler.
  142.   You can expect to get "*very* large speedups in the server" by not
  143.   using the bundled SunOS compiler.  I assume that similar results
  144.   would occur if you used one of the other high-quality commercial
  145.   compilers on the market.
  146.  
  147. Locking the Server into RAM?
  148. - - - - - - - - - - - - - - -
  149.   Has anyone tried hacking the X server so that it is locked into RAM and
  150.   does not get paged?  eg: via a call to plock().  Does this help
  151.   performance at all?  I've had one inquiry on this topic, and a few
  152.   pointers to the plock() function call, but no hard evidence from someone
  153.   who's tried it.  I am not in a position to give it a try.  
  154.               [thanks to: Eric C Claeys (ecc@eperm.att.com),
  155.                       Danny Backx (db@sunbim.be),
  156.                       Juan D. Martin (juando@cnm.us.es) ]
  157. Starting your Server
  158. - - - - - - - - - - -
  159.   Joe English (joe@trystero.art.com) :
  160.     If you start up a lot of clients in your .xsession or whatever, sleep
  161.     for a second or two after launching each one.  After I changed my
  162.     .xclients script to do this, logging in actually took *less* time...
  163.     we have a heavily loaded system without much core, though.
  164.  
  165.   This sounds crazy, but I have confirmed that it works!  
  166.  
  167.   Warner Losh (imp@Solbourne.COM) provided me with a good explanation of
  168.   why this works, which I have summarized here:
  169.  
  170.     When you start up an X server it takes a huge amount of time to
  171.     start accepting connections.  A lot of initialization is done by
  172.     the server when it starts.  This process touches a large number of
  173.     pages.  Any other process running at the same time would fight the
  174.     server for use of the CPU, and more importantly, memory.  If you
  175.     put a sleep in there, you give the Server a chance to get itself
  176.     sorted out before the clients start up.
  177.  
  178.     Similarly, there is also a lot of initialization whenever an X
  179.     client program starts: toolkits registering widgets, resources
  180.     being fetched, programs initializing state and "databases" and so
  181.     forth.  All this activity is typically memory intensive.  Once this
  182.     initialization is done ("The process has reached a steady state"),
  183.     the memory usage typically settles down to using only a few pages.
  184.     By using sleeps to stagger the launching of your clients in your
  185.     .Xinitrc , you avoid them fighting each other for your
  186.     workstation's limited resources
  187.  
  188.   This is most definitely a "Your Mileage May Vary" situation, as there
  189.   are so many variables to be considered: available RAM, local swap
  190.   space, load average, number of users on your system, which clients
  191.   you are starting, etc.
  192.  
  193.   Currently in my .xinitrc I have a situation like:
  194.     (sleep 1; exec xclock ) &
  195.     (sleep 1; exec xbiff ) &
  196.     (sleep 1; exec xterm ) &
  197.     (sleep 1; exec xterm ) &
  198.  
  199.   I've experimented with:
  200.     (sleep 1; exec xclock ) &
  201.     (sleep 2; exec xbiff ) &
  202.     (sleep 3; exec xterm ) &
  203.     (sleep 4; exec xterm ) &
  204.  
  205.   I've even tried:
  206.     (sleep 2; exec start_X_clients_script ) &
  207.   and then in start_X_clients_script I had:
  208.     (sleep 1; exec xclock ) &
  209.     (sleep 1; exec xbiff ) &
  210.     (sleep 1; exec xterm ) &
  211.     (sleep 1; exec xterm ) &
  212.  
  213.     [ The idea with this last one was to make sure that xinit had
  214.     completely finished processing my .xinitrc, and had settled down
  215.     into a "steady state" before the sleep expired and all my clients
  216.     were launched. ]
  217.  
  218.   All of these yielded fairly comparable results, and so I just stuck with
  219.   my current setup, for its simplicity.  You will probably have to
  220.   experiment a bit to find a setup which suits you.
  221.  
  222. Fonts
  223. - - -
  224.   Loading fonts takes time and RAM.  If you minimize the number of fonts
  225.   your applications use, you'll get speed increases in load-up time.
  226.  
  227.   One simple strategy is to choose a small number of fonts (one small, one
  228.   large, one roman, whatever suits you) and configure all your clients -- or
  229.   at least all your heavily used clients -- to use only those few fonts.
  230.   Client programs should start up quicker if their font is already loaded
  231.   into the server.  This will also conserve server resources, since fewer
  232.   fonts will be loaded by the server.
  233.                   [ Farrell McKay (fbm@ptcburp.ptcbu.oz.au),
  234.                     Joe English (joe@trystero.art.com) ]
  235.  
  236.   eg: My main xterm font is 7x13, so I also have twm set up to use 7x13
  237.   in all it's menus and icons etc.  Twm's default font is 8x13.  Since
  238.   I don't normally use 8x13, I've eliminated one font from my server.
  239.  
  240.   Oliver Jones (oj@roadrunner.pictel.com):
  241.     Keep fonts local to the workstation, rather than loading them over nfs.
  242.     If you will make extensive use of R5 scalable fonts, use a font server.
  243.  
  244. About the Resources File
  245. - - - - - - - - - - - - -
  246.  
  247.     Keep your .Xresources / .Xdefaults file small.  Saves RAM and saves
  248.     on server startup time.          Joe English (joe@trystero.art.com)
  249.  
  250.   One suggestion:
  251.  
  252.     In your .Xdefaults (.Xresources) file, try putting only the minimum
  253.     number of resources that you want to have available to all of your
  254.     applications.  For example:  *reverseVideo: true
  255.  
  256.     Then, separate your resources into individual client-specific
  257.     resource files.  For example: $HOME/lib/app-defaults.  In your
  258.     .login file set the environment variable XUSERFILESEARCHPATH:
  259.  
  260.     setenv XUSERFILESEARCHPATH $HOME/lib/app-defaults/%N
  261.  
  262.     [ The "comp.windows.x Frequently Asked Questions" FAQ contains
  263.     an excellent explanation of how these environment variables work.
  264.     --ed.]
  265.  
  266.     So, when xterm launches, it loads its resources from
  267.     .../app-defaults/XTerm.  Xdvi finds them in .../app-defaults/XDvi,
  268.     and so on and so forth.  Note that not all clients follow the same
  269.     XXxxx resource-file naming pattern.  You can check in your system
  270.     app-defaults directory (often: /usr/X11R5/lib/X11/app-defaults/) to
  271.     find the proper name, and then name your personal resource files
  272.     with the same name.
  273.  
  274.     This is all documented in the Xt Specification (pg 125 & 666).
  275.             [Thanks to: Kevin Samborn (samborn@mtkgc.com),
  276.                  Michael Urban (urban@cobra.jpl.nasa.gov),
  277.                      and Mike Long (mikel@ee.cornell.edu).
  278.          Kevin is willing mail his setup files to inquirers.]
  279.  
  280.   This method of organizing your personal resources has the following
  281.   benefits:
  282.  
  283.     - Easier to maintain / more usable.
  284.  
  285.     - Fewer resources are stored in the X server in the RESOURCE_MANAGER
  286.       property.  As a side benefit your server may start fractionally
  287.       quicker, since it doesn`t have to load all your resources.
  288.  
  289.     - Applications only process their own resources, never have to sort 
  290.       through all of your resources to find the ones that affect them.
  291.  
  292.   It also has drawbacks:
  293.  
  294.     - the application that you are interested in has to load an
  295.       additional file every time it starts up.  This doesn't seem to
  296.       make that much of a performance difference, and you might
  297.       consider this a huge boon to usability.  If you are modifying an
  298.       application's resource database, you just need to re-run the
  299.       application without having to "xrdb" again.
  300.  
  301.     - xrdb will by default run your .Xdefaults file through cpp.  When
  302.       your resources are split out into multiple resource files and
  303.       then loaded by the individual client programs, they will not.
  304.       WATCH OUT FOR THIS!!
  305.  
  306.       I had C style comments in my .Xdefaults file, which cpp stripped
  307.       out.  When I switched to this method of distributed resource
  308.       files I spent several frustrating days trying to figure out why
  309.       my clients were not finding their resources.  Xt did *NOT*
  310.       provide any error message when it encountered the C style
  311.       comments in the resource files, it simply, silently, aborted
  312.       processing the resource file.
  313.  
  314.       The loss of preprocessing (which can be very handy, e.g. ``#ifdef
  315.       COLOR'' ...) is enough to cause some people to dismiss this
  316.       method of resource management.
  317.  
  318.     - You may also run into some clients which break the rules.  For
  319.       example, neither Emacs (18.58.3) nor Xvt (1.0) will find their
  320.       resources if they are anywhere other than in .Xdefaults.
  321.  
  322.     - when starting up a client on a machine that does not share files
  323.       with the machine where your resources are stored, your client
  324.       will not find its resources.  Loading all your resources into the
  325.       server will guarantee that all of your clients will always find
  326.       their resources.            Casey Leedom (casey@gauss.llnl.gov)
  327.  
  328.   A possible compromise suggestion that I have (and am planning on trying)
  329.   is to put resources for all my heavily used clients (eg: xterm) into my
  330.   .Xdefaults file, and to use the "separate resources files" method for
  331.   clients that I seldom use.
  332.  
  333. Define Your Display Properly
  334. - - - - - - - - - - - - - - -
  335.  
  336.   Client programs are often executed on the same machine as the server.  In
  337.   that situation, rather than setting your DISPLAY environment variable to 
  338.   "<hostname>:0.0", where <hostname> is the name of your workstation, you
  339.   should set your DISPLAY variable to "unix:0.0" or ":0.0".  By doing this
  340.   you access optimized routines that know that the server is on the same
  341.   machine and use a shared memory method of transferring requests.
  342.             [thanks to Patrick J Horgan (pjh70@ras.amdahl.com)]
  343.  
  344.   See the _DISPLAY NAMES_ section of the X(1) man page for further
  345.   explanation of how to properly set your display name.
  346.  
  347.   "I don't think it's stock MIT, but (at least) Data General and HP have
  348.   libraries that are smart enough to use local communication even when
  349.   the DISPLAY isn't set specially."
  350.                   Rob Sartin (88opensi!sartin@uunet.UU.NET)
  351.  
  352.   [Jody Goldberg (jody@algorithmics.com) sent me an Xlib patch to change
  353.   stock R5 to use local communication even if DISPLAY is not properly set.
  354.   I don't want to get in the business of distributing or trying to juggle
  355.   non-MIT patches and so have elected not to include it here.  Hopefully MIT
  356.   will apply this minor (~8 lines) patch themselves.  In the meantime, if
  357.   you want to try it yourself, email Jody.  --ed.]
  358.  
  359. -------
  360. Clients
  361. -------
  362.  
  363.   If you only have a few megabytes of Ram then you should think
  364.   carefully about the number of programs you are running.  Think also
  365.   about the _kind_ of programs you are running.  For example:  Is there
  366.   a smaller clock program than xclock?
  367.  
  368.   Unfortunately, I haven't really noticed that programs advertise how large
  369.   they are, so the onus is on us to do the research and spread the word.
  370.  
  371.   [ Suggestions on better alternatives to the some of the standard clients
  372.   (eg: Xclock, Xterm, Xbiff) are welcome.  --ed.]
  373.  
  374.   I've received some contradictory advice from people, on the subject
  375.   of X client programs.  Some advocate the use of programs that are
  376.   strictly Xlib based, since Xt, Xaw and other toolkits are rather
  377.   large.  Others warn us that other applications which you are using
  378.   may have already loaded up one or more of these shared libraries.  In
  379.   this case, using a non-Xt (for example) client program may actually
  380.   _increase_ the amount of RAM consumed.
  381.  
  382.   The upshot of all this seems to be: Don't mix toolkits.  That is, try
  383.   and use just Athena clients, or just Xview clients (or just Motif
  384.   clients, etc).  If you use more than one, then you're dragging in
  385.   more than one toolkit library.
  386.  
  387.   Know your environment, and think carefully about which client
  388.   programs would work best together in that environment.
  389.  
  390.           [Thanks to: Rob Sartin (88opensi!sartin@uunet.UU.NET),
  391.       Duncan Sinclair (sinclair@dcs.gla.ac.uk | sinclair@uk.ac.gla.dcs) ]
  392.  
  393. A Better Clock for X
  394. - - - - - - - - - - -
  395.  
  396. 1) xcuckoo
  397.    suggested by: Duncan Sinclair (sinclair@dcs.gla.ac.uk)
  398.    available: on export.lcs.mit.edu
  399.  
  400.    Xcuckoo displays a clock in the title bar of *another* program.
  401.    Saves screen real estate.
  402.  
  403. 2) mclock
  404.    suggested by: der Mouse (mouse@Lightning.McRCIM.McGill.EDU)
  405.    available: larry.mcrcim.mcgill.edu (132.206.1.1) in /X/mclock.shar
  406.  
  407.    Non Xt-based.  Extensively configurable.  it can be made to look
  408.    very much like MIT oclock, or mostly like xclock purely by changing
  409.    resources.
  410.  
  411.   Of course, the ultimate clock --- one that consumes no resources, and 
  412.   takes up no screen real estate --- is the one that hangs on your wall.
  413.   :-) 
  414.  
  415. A Better Terminal Emulator for X
  416. - - - - - - - - - - - - - - - - -
  417.  
  418.   From the README file distributed with xterm:
  419.  
  420.   +-----
  421.   |         Abandon All Hope, Ye Who Enter Here
  422.   |
  423.   | This is undoubtedly the most ugly program in the distribution.
  424.   | ...
  425.   +-----
  426.  
  427.   Ugly maybe, but at my site it's still the most used.  I suspect that
  428.   xterm is one of the most used clients at many, if not most sites.
  429.   Laziness?  Isn't there a better terminal emulator available?  See below.
  430.  
  431.   If you must use xterm, you can try reducing the number of saveLines
  432.   to reduce memory usage.  [ Oliver Jones (oj@roadrunner.pictel.com),
  433.            Jonny Farringdon (j.farringdon@psychol.ucl.ac.uk) ]
  434.  
  435. 1) Xvt
  436.    suggested by: Richard Hesketh (rlh2@ukc.ac.uk) :
  437.    available: export.lcs.mit.edu in /contrib/xvt-1.0.tar.Z
  438.  
  439.    "...if you don't need all the esoteric features of xterm, then get
  440.    hold of xvt ...  it was written here just to save swap space as
  441.    xterm is rather a hog! "
  442.  
  443.    This was written as a partial 'clone' of xterm.  You don't have to
  444.    rename your resources, as xvt pretends to be XTerm.  In it's current
  445.    version, you cannot bind keys as you can in xterm.  I've heard that
  446.    there are versions of xvt with this feature, but I've not found any
  447.    yet.
  448.  
  449.    UPDATE (March 1993):  I recently had a few email conversations with
  450.    Brian Warkentin (brian.warkentine@eng.sun.com) regarding xvt.  He
  451.    questions whether xvt really is at all faster than xterm.  For
  452.    instance, xvt may initialize slightly faster, but compare scrolling
  453.    speed (try this quickie benchmark: /bin/time dd if=/etc/termcap
  454.    bs=40) and see which program can scroll faster.  Also, while xterm
  455.    may be slightly larger in RAM requirements (We don't have any hard
  456.    numbers here, does anyone else?) shared libraries and shared text
  457.    segments mean that xterm's paging requirements are not that major.
  458.  
  459.    As an experiment, he ripped out all the tek stuff from xterm, but it
  460.    made little difference, since if you never use it, it never gets
  461.    brought into memory.
  462.  
  463.    So here we stand with some conflicting reports on the validity of
  464.    xvt over xterm.  In summary?  Caveat Emptor, your mileage may vary.
  465.    If you can provide some hard data, I'd like to see it.
  466.    Specifically: How much RAM each occupies, how much swap each needs,
  467.    relative speed of each
  468.  
  469. 2) mterm
  470.    suggested by: der Mouse (mouse@Lightning.McRCIM.McGill.EDU)
  471.    available: larry.mcrcim.mcgill.edu (132.206.1.1) in
  472.      /X/mterm.src/mterm.ball-o-wax.
  473.  
  474.    "I also have my own terminal emulator.  Its major lack is
  475.    scrollback, but some people like it anyway."
  476.  
  477.  
  478. Tuning your client
  479. - - - - - - - - - -
  480.  
  481.   Suggestions on how you can tune your client programs to work faster.
  482.  
  483.   From Scott Barman (scott@asd.com) comes a suggestion regarding Motif
  484.   Text Field Widgets:
  485.  
  486.     I noticed that during data entry into Motif text field widgets, I
  487.     was getting a slight lag in response to some keystrokes,
  488.     particularly the initial one in the field.  Examining the what was
  489.     going on with xscope I found it.  It seems that when the resource
  490.     XmNblinkRate is non-zero and the focus is on a text field widget
  491.     (or even just a text widget) the I-beam cursor will blink.
  492.     Every time the cursor appears or disappears in those widgets, the
  493.     widget code is making a request to the server (CopyArea).  The user
  494.     can stop this by setting the resource XmNblinkRate to 0.  It is not
  495.     noticeable on a 40MHz SPARC, but it does make a little difference
  496.     on a [slower system].
  497.  
  498.   This specific suggestion can probably be applied in general to lots
  499.   of areas.  Consider your heavily used clients, are there any minor
  500.   embellishments that can be turned off and thereby save on Server
  501.   requests?
  502.  
  503. -------------------------
  504. Miscellaneous Suggestions
  505. -------------------------
  506.  
  507. Pretty Pictures
  508. - - - - - - - -
  509.   Don't use large bitmaps (GIF's, etc) as root window backgrounds.
  510.  
  511.   - The more complicated your root window bitmap, the slower the server
  512.     is at redrawing your screen when you reposition windows (or redraw, etc)
  513.  
  514.   - These take up RAM, and CPU power.  I work on a Sun SPARC and I'm
  515.     conscious of performance issues, I can't comprehend it when I see
  516.     people with a 4mb Sun 3/60 running xphoon as their root window.
  517.  
  518.     I'll let someone else figure out how much RAM would be occupied by
  519.     having a full screen root image on a colour workstation.
  520.  
  521.   - If you're anything like me, you need all the screen real estate
  522.     that you can get for clients, and so rarely see the root window anyway.
  523.  
  524.               [ Thanks to Qiang Alex Zhao (azhao@cs.arizona.edu) 
  525.             for reminding me of this one. --ed.]
  526.  
  527. A Quicker Mouse
  528. - - - - - - - -
  529.   Using xset, you can adjust how fast your pointer moves on the screen
  530.   when you move your mouse.  I use "xset m 3 10" in my .xinitrc file,
  531.   which lets me send my pointer across the screen with just a flick of
  532.   the wrist.  See the xset man page for further ideas and information.
  533.  
  534.   Hint: sometimes you may want to *slow down* your mouse tracking for
  535.   fine work.  To cover my options, I have placed a number of different
  536.   mouse setting commands into a menu in my window manager.  
  537.  
  538.   e.g. (for twm) :
  539.       menu "mouse settings" {
  540.         "Mouse Settings:"            f.title
  541.     "  Very Fast"                ! "xset m 7 10 &"
  542.     "  Normal (Fast)"            ! "xset m 3 10 &"
  543.     "  System Default (Un-Accelerated)"    ! "xset m default &"
  544.     "  Glacial"                ! "xset m 0 10 &"
  545.       }
  546.  
  547. Programming Thoughts
  548. - - - - - - - - - - -
  549.   Joe English (joe@trystero.art.com) :
  550.     To speed up applications that you're developing, there are tons of
  551.     things you can do.  Some that stick out:
  552.  
  553.     - For Motif programs, don't set XmFontList resources for individual
  554.       buttons, labels, lists, et. al.; use the defaultFontList or
  555.       labelFontList or whatever resource of the highest-level manager
  556.       widget.  Again, stick to as few fonts as possible.
  557.  
  558.     - Better yet, don't use Motif at all.  It's an absolute pig.
  559.  
  560.     - Don't create and destroy widgets on the fly.  Try to reuse them.
  561.       (This will avoid many problems with buggy toolkits, too.)
  562.  
  563.     - Use a line width of 0 in GCs.  On some servers this makes a HUGE
  564.       difference.
  565.  
  566.     - Compress and collapse multiple Expose events.  This can make the
  567.       difference between a fast application and a completely unusable
  568.       one.
  569.  
  570.   Francois Staes (frans@kiwi.uia.ac.be) :
  571.     Just a small remark: I once heard that using a better malloc
  572.     function would greatly increase performance of Xt based
  573.     applications since they use malloc heavily. They suggested trying
  574.     out the GNUY malloc, but I didn't find the time yet. I did some
  575.     tests on small programs just doing malloc and free, and the
  576.     differences were indeed very noticeable ( somewhat 5 times faster)
  577.  
  578.   [ Any confirmation on this from anyone?  --ed.]
  579.  
  580.   Andre' Beck (Andre_Beck@IRS.Inf.TU-Dresden.de) :
  581.  
  582.   - Unnecessary NoExpose Events.
  583.  
  584.     Most people use XCopyArea/XCopyPlane as fastest blit routines, but
  585.     they forget to reset graphics_exposures in the GC used for the
  586.     blits. This will cause a NoExpose Event every blit, that, in most
  587.     cases, only puts load onto the connection and forces the client to
  588.     run through it's event-loop again and again.
  589.  
  590.   - Thousands of XChangeGC requests.
  591.  
  592.     This "Gfx Context Switching" is also seen in most handcoded X-Apps,
  593.     where only one or few GCs are created and then heavily changed
  594.     again and again.  Xt uses a definitely better mechanism, by caching
  595.     and sharing a lot of GCs with all needed parameters. This will
  596.     remove the load of subsequent XChangeGC requests from the
  597.     connection (by moving it toward the client startup phase).
  598.  
  599. Say What!?
  600. - - - - - - 
  601.   Some contributors proposed ideas that seem right off the wall at first:
  602.  
  603.   David B. Lewis (by day: dbl@osf.org, by night: david%craft@uunet.uu.net) :
  604.     How about this: swap displays with someone else. Run all your programs
  605.     on the other machine and display locally; the other user runs off your
  606.     machine onto the other display. Goal: reduce context switches in the
  607.     same operation between client and server.
  608.  
  609.   I'm not in a situation where I can easily try this, but I have received
  610.   the following confirmation...
  611.  
  612.   Michael Salmon (Michael.Salmon@eos.ericsson.se):
  613.     I regularly run programs on other machines and I notice a big
  614.     difference. I try to run on a machine where I will reduce net usage
  615.     and usually with nice to reduce the impact of my intrusion. This
  616.     helps a lot on my poor little SS1+ with only 16 MB, it was
  617.     essential when I only had 8 MB.
  618.  
  619.   Casey Leedom (casey@gauss.llnl.gov) :
  620.     [The X11 Server and the client are] competing for the same CPU as
  621.     your server when you run it on the same machine.  Not really a
  622.     major problem, except that the X11 client and the server are in
  623.     absolute synchronicity and are context thrashing.
  624.  
  625.   Timothy H Panton (thp@westhawk.uucp) :
  626.     Firstly it relies on the fact that most CPU's are mostly idle, X's
  627.     cpu usage is bursty.  so the chances of you and your teammate
  628.     doing something cpu-intensive at the same time is small. If they
  629.     are not then you get twice the cpu+memory available for your
  630.     action.
  631.  
  632.     The second factor is that context switches are expensive, using 2
  633.     cpu's halves them, you pay a price due to the overhead of going
  634.     over the network, but this is offset in most cases by the improved
  635.     buffering of a network (typically 20k vs 4k for a pipe), allowing
  636.     even fewer context switches.
  637.  
  638. ----------------------------
  639. Other Sources of Information
  640. ----------------------------
  641.  
  642.   Volume 8 in O'Reilly's X Window System Series, ``X Window System
  643.   Administrator's Guide'' is a book all X administrator's should read.
  644.  
  645.   Adrian Nye (adrian@ora.com):
  646.     A lot more tips on performance are in the paper "Improving X
  647.     Application Performance" by Chris D. Peterson and Sharon Chang, in
  648.     Issue 3 of The X Resource.
  649.  
  650.     An earlier version of this paper appeared in the Xhibition 1992
  651.     conference proceedings.
  652.  
  653.     This paper is absolutely essential reading for X programmers.
  654.  
  655. --------------
  656. Author & Notes
  657. --------------
  658.   This list is currently maintained by Art Mulder (art@cs.ualberta.ca)
  659.  
  660.   Suggestions, corrections, or submission for inclusion in this list
  661.   are gladly accepted.  Layout suggestions and comments (spelling
  662.   mistak's too! :-) are also welcome.
  663.  
  664.   Currently I have listed all contributors of the various comments and
  665.   suggestions.  If you do not want to be credited, please tell me.
  666.  
  667.   speedup-x-faq is copyright (c) 1993 by Arthur E. Mulder
  668.  
  669.   You may copy this document in whole or in part as long as you don't
  670.   try to make money off it, or pretend that you wrote it.
  671.  
  672. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  673. --
  674.  ...art mulder ( art@cs.ualberta.ca )    | "Do not be conformed to this world,
  675.  Department of Computing Science         |  but be transformed by the renewal
  676.  University of Alberta, Edmonton, Canada |  of your mind, ..."  Romans 12:2
  677.