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

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



     From: cogen@XN.LL.MIT.EDU
     dc>    I measured the time to do draw 240 rectangles (with :DRAW-RECTANGLE) ...
     smk> How about passing along the code you used to do this?
     dc> Here is some simplified but meaningless code that exhibits similar time
     dc>   disparities to my original:

     (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: ...

     (TEST DW)
     Evaluation of (DO-IT W) took 168.329730 seconds of elapsed time including:
       <lots of consing>  ....

Upon first glance, I found this a bit surprising, so I tried it myself. 
The code above was compiled, of course.

 (test sw)
Evaluation of (DO-IT W) took 6.157557 seconds of elapsed time including:
 < essentially no consing>
 < same figures no matter how many times I ran it>

 (test dw)
Evaluation of (DO-IT W) took 35.033844 seconds of elapsed time including:
  0.513 seconds processing sequence breaks,
  1.217 seconds in the storage system (including 0.047 seconds waiting for pages):
    0.144 seconds processing 135 page faults including 6 fetches,
    1.067 seconds in creating and destroying pages, and
    0.005 seconds in miscellaneous storage system tasks.
23,159 list, 18,928 structure words consed in WORKING-STORAGE-AREA.
68,000 structure words consed in *PRESENTATION-AREA*.

 (test dw)					; again
Evaluation of (DO-IT W) took 65.448608 seconds of elapsed time including: ...

 (test dw)					; again
Evaluation of (DO-IT W) took 105.005966 seconds of elapsed time including: ...

  (test dw)					; fourth time
Evaluation of (DO-IT W) took 128.082050 seconds of elapsed time including: ...

Now, recompile the (DEFVAR DW ...), ie. NEW window with EMPTY histories:
     (test dw)
Evaluation of (DO-IT W) took 35.459057 seconds of elapsed time including: ...

Ah Hah; it seems clear that the run time is increasing in proportion to the
number of (invisible overwritten) rectangles that the presentation manager
(whoops, `smart cue', .. whatever) has to sift through to put the new ones in.

So, as suggested (if appropriate):
(DEFUN DO-IT (W)
  (dw:with-output-recording-disabled (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))))
New DW and :
  (test dw) 
Evaluation of (DO-IT W) took 9.780945 seconds of elapsed time including:
....
33 list, 29 structure words consed in WORKING-STORAGE-AREA.
 <same thing every time>

So, recording the output is EXPENSIVE, IFF you dont need it. (two F's is NOT a typo)

    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.
I'm pretty sure that you DO need output recording to be able to scroll your window.
Well, if you want something to appear in your scrolled window, anyway.

My supper is getting cold, so I'm not going to try to solve or suggest anything
more tonight ... maybe tommorrow. 

			Bruce
			MILLER@VAX.CAM.NBS.GOV