News combit Dev Blog

Enhanced Performance for Treeviews

Posted: Wednesday, February 10, 2016 | 0 comment(s)
 
List & Label makes extensive use of the windows tree view control. Since version 21, we even support multi selection and Drag & Drop from the Variables/Fields Window. While the tree control works very nicely for a reasonable number of items, things change considerably once we're talking of hundreds of thousands of entries.

This number is quickly reached if you're working with non trivial database schemas and relations. By default, each and every 1:n relation is "mirrored" as 1:1 relation in the field tree. Thus, if you have a few hundred tables, each with several hundred fields and many relations– you're doomed. The Windows treeview API is message based and item lookup and iteration is dead slow. And things get worse for multiselect tree views. In order to get the number of selected items, you can't rely on one of the handy Treeview_... macros (which are internally optimized) but need to loop through all the items, get the selection state of each and count the selected ones. Passing the focus to the tree view can thus result in a delay of more than a second, depending on the schema size of your data.

The same holds for the function wizard (which also has a tree of fields and variables) and several other windows. While working with the Designer is still possible, it's certainly no fun. Thanks to Thomas Wurl, our Progress Guru, for raising our attention to this issue. He's currently writing a brand new data provider for Progress which will be covered in another blog post soon.

The solution we implemented for this issue is a separate, internal cache of all the tree items and a separate list for the selected ones. In order to get the state of a particular one we don't need to SendMessage our way into the tree but can do a quick lookup in our list and iteration is done in the memory based cache. The true challenge was to keep both structures synchronized which took a couple of days for testing, fixing, re-testing etc. but it was absolutely worth the effort. All tree views are blazingly fast now and the design time experience is what you would expect from a best of breed tool. See for yourself – this test setup compares the performance of 21.001 to that of 21.002.  

First, we have added 500 tables, each containing 100 fields which makes a whopping 50000 tree view entries. Even the old version doesn't do too bad, however you can easily see the slight delay when opening and selecting items:
 

before
Enhanced Performance for Treeviews
 
after
Enhanced Performance for Treeviews
 

 
If we double the number of items to 100000 you can see why this change was really mandatory:

 
before
Enhanced Performance for Treeviews
 
after
Enhanced Performance for Treeviews
 
 
This feature will be released in version 21 with Service Pack 21.002. If you're interested in beta testing it feel free to drop me a note and we'll be sending you updated binaries right away.




Author: Jochen Bartlau
Head of Development List & Label

Jochen Bartlau leads the development at combit as Managing Director. He's a Microsoft .NET enthusiast driving innovation & agile project management. The mobile devices geek who used to be a physicist in his first life loves to spend his spare time with his family.


  

RSS
combit Development BlogRSS
What’s this blog for?
A place to share updates about the ongoing development of our products. General musings on the software industry included.
Archive
January 2021 (1)
December 2020 (2)
November 2020 (1)
October 2020 (2)
September 2020 (1)
August 2020 (2)
July 2020 (1)
June 2020 (1)
May 2020 (2)
April 2020 (2)
March 2020 (2)
February 2020 (1)
January 2020 (1)
December 2019 (1)
November 2019 (2)
October 2019 (2)
September 2019 (2)
August 2019 (2)
July 2019 (2)
June 2019 (2)
May 2019 (1)
April 2019 (0)
April 2019 (1)
March 2019 (1)
February 2019 (1)
January 2019 (1)
December 2018 (1)
November 2018 (2)
October 2018 (4)
September 2018 (4)
August 2018 (2)
July 2018 (2)
June 2018 (2)
May 2018 (1)
April 2018 (1)
March 2018 (1)
February 2018 (2)
January 2018 (1)
December 2017 (1)
November 2017 (2)
October 2017 (3)
September 2017 (3)
August 2017 (2)
July 2017 (2)
June 2017 (1)
May 2017 (2)
April 2017 (1)
March 2017 (1)
February 2017 (1)
January 2017 (2)
December 2016 (1)
November 2016 (1)
October 2016 (4)
September 2016 (5)
August 2016 (2)
July 2016 (2)
June 2016 (3)
May 2016 (2)
April 2016 (3)
March 2016 (3)
February 2016 (1)
January 2016 (2)
December 2015 (2)
November 2015 (1)
October 2015 (4)
September 2015 (5)
August 2015 (2)
July 2015 (2)
June 2015 (2)
May 2015 (1)
April 2015 (2)
March 2015 (1)
February 2015 (1)
January 2015 (1)
December 2014 (2)
November 2014 (1)
October 2014 (1)
September 2014 (2)
August 2014 (1)
July 2014 (2)
June 2014 (1)
May 2014 (2)
April 2014 (1)
March 2014 (2)
+1 800 256 3608 (toll-free North America only)