1. Win32Lib: Possible problem with eraseItems() against a tree view?
- Posted by Jonas Temple <jtemple at yhti.net> Jun 03, 2003
- 406 views
Derek, Using the attached example, first click the "Load a lot" button. 250 tree view items should be loaded. Then click the "Load a few" button to load 1 item. eraseItems() is called to clear the tree view before loading the single item is added and the clear time is extremely long. The scroll bar changes height so you can tell something is happening. I found this condition with win32lib v0.58.8 and v0.59.0. I'm using IDE v0.17.0 on a Win2K Pro machine. Thanks, Jonas -- code generated by Win32Lib IDE v0.17.0 include Win32Lib.ew without warning -------------------------------------------------------------------------------- -- Window Window1 global constant Window1 = createEx( Window, "Test tree view clearing", 0, Default, Default, 516, 462, {WS_DLGFRAME, WS_SYSMENU}, {WS_EX_DLGMODALFRAME} ) global constant TreeView2 = createEx( TreeView, "", Window1, 16, 76, 480, 328, or_all({TVS_HASLINES,TVS_LINESATROOT,TVS_HASBUTTONS,TVS_SHOWSELALWAYS}), 0 ) constant closefolder = addIcon( extractIcon("clsdfold.ico") ) constant openfolder = addIcon( extractIcon("openfold.ico") ) global constant LoadFew = createEx( PushButton, "Load a few", Window1, 28, 28, 88, 28, 0, 0 ) global constant LoadLot = createEx( PushButton, "Load a lot", Window1, 132, 28, 88, 28, 0, 0 ) global constant Exit = createEx( PushButton, "Exit", Window1, 240, 28, 88, 28, 0, 0 ) --------------------------------------------------------- -------------------------------------------------------------------------------- procedure LoadFew_onClick (integer self, integer event, sequence params)--params is () atom void eraseItems(TreeView2) void = addTVItem(TreeView2, 0, 0, "One item", 0) end procedure setHandler( LoadFew, w32HClick, routine_id("LoadFew_onClick")) -------------------------------------------------------------------------------- procedure LoadLot_onClick (integer self, integer event, sequence params)--params is () atom void eraseItems(TreeView2) for i = 1 to 250 do void = addTVItem(TreeView2, 0, 0, sprintf("%d",i), 0) end for end procedure setHandler( LoadLot, w32HClick, routine_id("LoadLot_onClick")) -------------------------------------------------------------------------------- procedure Exit_onClick (integer self, integer event, sequence params)--params is () closeWindow(Window1) end procedure setHandler( Exit, w32HClick, routine_id("Exit_onClick")) WinMain( Window1,Normal )
2. Re: Win32Lib: Possible problem with eraseItems() against a tree view?
- Posted by Derek Parnell <ddparnell at bigpond.com> Jun 03, 2003
- 408 views
----- Original Message ----- From: "Jonas Temple" <jtemple at yhti.net> To: "EUforum" <EUforum at topica.com> Subject: Win32Lib: Possible problem with eraseItems() against a tree view? > > > Derek, > > Using the attached example, first click the "Load a lot" button. 250 > tree view items should be loaded. Then click the "Load a few" button to > load 1 item. eraseItems() is called to clear the tree view before > loading the single item is added and the clear time is extremely long. > The scroll bar changes height so you can tell something is happening. > > I found this condition with win32lib v0.58.8 and v0.59.0. I'm using IDE > v0.17.0 on a Win2K Pro machine. Yes there could be a problem. However it has been caused by the way that treeview has been implemented in the library. In win32lib, all treeview items in all treeviews are stored in RAM and a set of single sequences is used to manage them. This means that to delete an item, the library has to free up the RAM for that item and them delete its management data from four sequences. And on a slow machine that could be noticible. I can delete the entire sequence because other treeviews might be sharing it, so I have to remove each item seperately. On my home machine, the example you supplied takes a lot less than a second to clear the old data. I wouldn't have even noticed unless you pointed it out. I have in my plans to rewrite the treeview implementation to improve its performance. -- Derek
3. Re: Win32Lib: Possible problem with eraseItems() against a tree view?
- Posted by Derek Parnell <ddparnell at bigpond.com> Jun 03, 2003
- 377 views
On Tue, 03 Jun 2003 21:08:13 +0000, Jonas Temple <jtemple at yhti.net> wrote: > > > Less than a second? On this Win2K machine (I think the processor is > 1gHz) it takes 15 seconds. Even if your machine is a 2+ GHZ that > shouldn't make a 15 second difference. > Whooa! I just ran it on my machine at work Win2K, Pentium 3 550MHz. And it takes about 1/10 of a second (Yes, 0.1 seconds). I had to get it up to 2500 items before it took as long as a whole second. I think you have a problem with your system. -- cheers, Derek Parnell
4. Re: Win32Lib: Possible problem with eraseItems() against a tree view?
- Posted by Derek Parnell <ddparnell at bigpond.com> Jun 03, 2003
- 384 views
On Tue, 03 Jun 2003 21:08:13 +0000, Jonas Temple <jtemple at yhti.net> wrote: > > > Less than a second? On this Win2K machine (I think the processor is > 1gHz) it takes 15 seconds. Even if your machine is a 2+ GHZ that > shouldn't make a 15 second difference. > In fact, I commented out the memory management stuff in win32lib and just ran the API call. It still took 1 second for 2500 items. So I guess the Eu overhead is very very small. -- cheers, Derek Parnell
5. Re: Win32Lib: Possible problem with eraseItems() against a tree view?
- Posted by Robert Craig <rds at RapidEuphoria.com> Jun 04, 2003
- 389 views
Jonas Temple wrote: > Dererk, > > I also just tried this on my Win98 machine at home (550mhz) and it still > took 15 seconds. I also notice that if I alt+tab to another window and > then back to the example program it changes instantly. How's that for > weird? I haven't been following this thread, but I can't help but wonder if you (Jonas) are using Euphoria 2.4 alpha, and Derek is using 2.4 beta. There was a performance bug introduced into 2.4 alpha that was fixed in 2.4 beta. It had to do with freeing large numbers of items all at once. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
6. Re: Win32Lib: Possible problem with eraseItems() against a tree view?
- Posted by Derek Parnell <ddparnell at bigpond.com> Jun 04, 2003
- 404 views
----- Original Message ----- From: "Jonas Temple" <jtemple at yhti.net> To: "EUforum" <EUforum at topica.com> Subject: RE: Win32Lib: Possible problem with eraseItems() against a tree view? > > > Derek, > > I think I figured out why this is happening but I don't know if it's a > problem or a "feature". Try this and see if it slows down the > eraseItems(): > > 1. Right click in the desktop > 2. Select "Properties" from the popup > 3. Click the "Effects" tab > 4. Check the "Use transition effects for menus and tooltips" (I'm > assuming it's not checked on your system). > 5. Click Okay. > > Now run the program and see if the clear time is not dramatically > increased. Yep, that was it. As soon as I turned on this 'feature' the example you gave went into molasses mode. > Maybe I should call Uncle Bill on this one? :) Yeah. Sure. That'll work.