Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Question: [ searching for answer on GUI speed ]

From: sunandadh:aol at: 12-Mar-2002 5:57

Gregg:
> I think rendering only the visible parts is the only way to get things to > scale up, GUI-wise. In your example, you're creating somewhere around 600 > faces (if I understand that each of the 200 lines creates a Box, and 2 Text > items).
You are absolutely right for large-scale applications. If I'd thought I'd needed a tree with thousands of open branches, I'd have started with a different approach, or maybe not Rebol at all. I'm just disappointed that Rebol/View doesn't render fast enough for what I consider to be a small/medium application. To be fair to View, since sending that last email, I've actually looked at what my code produces for a tree node (similar code for leaves), and it is a bit more complicated than I'd indicated -- the code also captures each text face in a block, and sets up user-data. Return pad 40x0 Toggle 15x15 "-" "+" false user-data ["S" "Z1S0000W" "Esin-Z1-Z1S0000W"] [EsinTree/Toggle face/user-data/3 "Cseb-Tree"] ESINTREE-TEMPITEM: text Blue bold font-size 14 "Text description of node" edge copy [] user-data ["S" "Z1S0000W" "Esin-Z1-Z1S0000W"] [esinCseb/LC-Tree-face face] do (Append ESINTREE-TEMP ESINTREE-TEMPITEM) Although commenting out the Do and removing the assign makes an almost unmeasurable difference to the speed. The speed problem is in Layout and (I guess) relates to its speed at rendering. My basic application problem is that I re-Layout the whole tree every time there is a change to it. Maybe (typing aloud here) for _some_ changes, I could update all the individual VID faces -- that'd be messy, but it would mean the faces "above" the change are unaffected.
> I have a few ideas sketched out for how I might tackle a grid or tree-view, > but haven't made any stabs at implementations yet. The design path I'm > heading down is centered around DRAW commands rather than individual faces. > I have no idea, yet, what issues I'll run into though.
It's good to know someone is working on it. The sort of generic issues I came across while developing my application-specific tree viewer (it would take a bit of work to make it generic are): 1. Any change to the internal state (opening/closing a node, deleting a node or leaf, sorting the leaves in a node, moving a node or leaf) require me to re-render the _whole_ tree. This is exactly the sort of issue you want to avoid. 2. The internal tree object and its matching VID layout need to be cross-indexed -- so you can go from an entry in the object to its face, and from a face to the tree object. I chose to do that by: a. Ensuring each tree object entry has a unique id (its path from the root) b. Putting that id in the face's user-data (giving me via a tree search, a way to go from a face to its corresponding tree object) c. Capturing the faces in Layout and (after Layout) putting each face object into a variable in its corresponding tree object. This means the tree objects have "direct access" to their corresponding face, but at a cost of having an unmoldable tree (I wrote a tree-print routine to get round this). 3. My application implements a "persistant user state". So if the user is positioned at the end of the tree view when they exit, that's exactly where they are when they start it up again. Any rendering-on-the-fly code could not (in this instance) assume the application always starts up at the top of the tree -- so incremental rendering can't always be on a scroll-down, or window-enlarge action. 4. My tree object turned out to be more complicated than I'd first envision. With a bit of code-rework, I could lose a couple the fields, but right now it looks like: TREE-OBJECT: make object! [TC-Type: copy "?" ; node type TC-TypeID: copy "?" ; Node type level TC-SortID: copy "" ; Branch sort order TC-ID: copy "?" ; ID for this item TC-ParentID: none ; Internal id of parent TC-ParentNode: none ; actual node of parent TC-Title: copy "" ; Title to display TC-Open?: true ; Is this branch displayed? TC-Hidden?: false ; Is this node and branch hidden? TC-DATS: copy [] ; VID display attributes TC-LeftClick: copy [] ; VID Left click action TC-RightClick: copy [] ; VID Right click action TC-Face: none ; Actual VID face (none if in a closed or hidden branch) TC-NodeID: copy "" ; ----: Internal use only. to give ; each node a unique id TC-Inner: copy [] ; Child tree objects ] I hope that helps a little with the "user requirements" Good luck!! Sunanda.