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

CLX Speed: Pretty poor



   Date: Tuesday, 13 June 1989 12:21:03 EDT
   From: Brad.Myers@a.gp.cs.cmu.edu

   We ran some tests to see how fast CLX is, and it isn't.    Compared to
   calling the X routines from C, CLX is **approximately 15 times slower**
   (1500% slower).  This is running the standard CLX under CMU CommonLisp
   on IBM RTs with X11R3.  My impression is the Lucid CLX is not faster (and
   may be even slower).  

The C and Lisp codes are NOT equivalent.  The inner loop of the C code calls
XFillRectangle followed by XFlush.  The inner loop of the Lisp code calls
draw-rectangle (which IS equivalent) followed by display-finish-output (which
is equivalent to XSync).  Therefore, the Lisp code is doing a server round-trip
for every rectangle!!

   * Does anyone know if CLX is going to get faster?  (Please, please!) 

By default, CLX checks almost all function argument types. You can turn this
feature off and get significant code shrinkage and speedups.  Change
(defconstant *type-check?* t)
in the dependent.l file to
(defconstant *type-check?* nil)
By the way, the comments say you can set *type-check?* to :minimal, but it
lies. Most of the code checks for *type-check?* being null.

Another thing that can slow you down is if you're using the default
xlib::buffer-write-default function provided by CLX in the dependent.l file.
This function writes data to the server one byte at a time.  Release 3 CLX has
code for lisp machines and Lucid to write blocks of words.  Release 4 CLX will
have similar code for Franz.  I encourage you to write similar code for CMU
CommonLisp, and also to replace the default xlib::buffer-read-default.

A third think I have no way of checking on is your connection to the server.
Is the lisp code always going through TCP/IP, or does it pipe to the local
server?

   * Is there some way to write this code better?
YES, don't use display-finish-output. Use:
 (defmacro finish() '(xlib:display-force-output d))

   * Is CLX on some other machines faster?  (I challenge you to execute this
	   test yourself and see!)
I'm sure it's faster on a Lisp machine (TI Explorer or Symbolics)