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

are dynamic windows really 60X slower than old windows?!



    Date: Tue, 28 Feb 89 19:20:33 EDT
    From: cogen@xn.ll.mit.edu (David Cogen)

    (DEFVAR DW (TV:MAKE-WINDOW 'DW::DYNAMIC-WINDOW))

    (DEFVAR SW (TV:MAKE-WINDOW 'TV::WINDOW))

    (DEFUN TEST (W)
      (SEND W :EXPOSE)
      (TIME (DO-IT W))
      (SEND W :BURY))

    (DEFUN DO-IT (W)
      (LOOP REPEAT 1000
	    DO
	(SEND W :DRAW-RECTANGLE 200 20 10 10 TV:ALU-ANDCA)
	(SEND W :DRAW-STRING "HELLO" 10 10)
	(SEND W :DRAW-RECTANGLE 200 20 10 10)
	(SEND W :DRAW-RECTANGLE 200 20 10 10 TV:ALU-ANDCA)))

    Now I run TEST with the static window and dynamic window in turn:

      (TEST SW)
    Evaluation of (DO-IT W) took 6.289433 seconds of elapsed time including:
      0.089 seconds processing sequence breaks,
      0.116 seconds in the storage system (including 0.105 seconds waiting for pages):
	0.116 seconds processing 21 page faults including 3 fetches,
	0.000 seconds in creating and destroying pages, and
	0.000 seconds in miscellaneous storage system tasks.
    T

      (TEST DW)
    Evaluation of (DO-IT W) took 168.329730 seconds of elapsed time including:
      2.623 seconds processing sequence breaks,
      5.924 seconds in the storage system (including 4.312 seconds waiting for pages):
	4.891 seconds processing 668 page faults including 167 fetches,
	0.976 seconds in creating and destroying pages, and
	0.057 seconds in miscellaneous storage system tasks.
    23,728 list, 29,373 structure words consed in WORKING-STORAGE-AREA.
    768 list words consed in GC-TABLE-AREA.
    68,000 structure words consed in *PRESENTATION-AREA*.
    T

When I ran (TEST DW) it took 37 seconds the first time, and 78 seconds
a second time; it probably would have been 160 a time or two later.
There was an EGC during the second run, so it wasn't able to tell me
about consing, but I'll bet that the difference was due to the repeated
growing of the DISPLAYED-GRAPHICS array.  I added a (SEND-IF-HANDLES W
:CLEAR-HISTORY) before the TIME line in TEST, and that made the results
of repeated calls consistent.

    I am not interested in mouse-sensitivity here. I am using dynamic windows only for the
    ability to scroll through a virtual window bigger than the actual window size.
    But I will sacrifice this ability for speed, if necessary.

One problem is that in order to erase one piece of graphic output you
are actually drawing another piece, adding to the graphics output
history instead of deleting from it.  In addition to causing lots of
consing, it will make scrolling through this window very slow; in order
to scroll to a page it must re-execute all the graphics operations that
have ever been executed on that page.  This is a time/space tradeoff
decision that the DW implementors made -- instead of remembering the
entire bit image history of a window, it only remembers the graphic
operations (you can fit over a thousand
RECTANGLE-GRAPHICS-DISPLAYED-PRESENTATION objects in the space it takes
to hold one screen image).

What you probably want to use is DW:ERASE-DISPLAYED-PRESENTATION.  If
you use the GRAPHICS:DRAW-xxx functions instead of the obsolete
:DRAW-xxx messages you can supply the :RETURN-PRESENTATION T option, and
then supply this object when you want to erase the object.
Unfortunately, for some reason, DW:ERASE-DISPLAYED-PRESENTATION takes
about three times as long as GRAPHICS:DRAW-RECTANGLE :ALU :ERASE.
However, the savings you get when scrolling may make up for this.

                                                barmar