[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Subview performance problem
- To: psto@xs4all.nl (Peter Stone)
- Subject: Re: Subview performance problem
- From: poeck@informatik.uni-wuerzburg.de (Karsten Poeck)
- Date: Sun, 12 Feb 1995 18:48:40 +0100
- Cc: info-mcl@digitool.com
- Sender: owner-info-mcl@digitool.com
>I'm having a performance problem with subviews. I have a window of 1000
>subviews and it takes 27 seconds to build before you can start editing
>it. Scrolling is really slow even in Quadra. How to speed it up?
Perhaps you could group your subviews and have a little hierarchy. If you
really need that much items, consider implementing them from scratch using
traps. the following code should give you a start. We did this for all our
windows that would have required thousends of dialog-items.
Karsten
(require :quickdraw)
(require :scrollers)
(defstruct stupid-but-fast-text-item
position-x
position-y
text)
(defclass scroller-with-stupid-but-fast-text-items (ccl::scroller)
((list-of-stupid-but-fast-text-items :initform nil :accessor window-items)))
(defmethod visible-p ((ich scroller-with-stupid-but-fast-text-items) item)
(declare (ignore item))
;replace this with real code
t)
(defmethod draw-all-stupid-items ((ich
scroller-with-stupid-but-fast-text-items))
(multiple-value-bind
(a d m l)
(font-info (view-font ich))
(declare (ignore d m l))
(with-port (wptr ich)
(dolist (item (window-items ich))
(when (visible-p ich item)
(let ((position-x (stupid-but-fast-text-item-position-x item))
(position-y (stupid-but-fast-text-item-position-y item))
(text (stupid-but-fast-text-item-text item)))
(#_moveto position-x (+ a position-y))
(with-pstrs ((pointer text))
(#_drawstring pointer))))))))
(defmethod view-draw-contents :after ((ich
scroller-with-stupid-but-fast-text-items))
(draw-all-stupid-items ich))
(defun test-it (n)
(let ((scroller nil))
(make-instance 'window
:view-subviews (list
(setq scroller (make-instance
'scroller-with-stupid-but-fast-text-items
:field-size (make-point 1000 1000))))
)
(dotimes (x n)
(push (make-stupid-but-fast-text-item
:position-x x
:position-y (* x 11)
:text "Test")
(window-items scroller)))))
#|
(test-it 100)
|#