Fitness Via Laziness
Improvements done as part of NetBeans 6.5 release to improve performance and scalability of nodes/explorer.
- diff against trunk
- Added Children.Keys(boolean lazy) constructor
- Added Children.getNodesCount(boolean optimalResult)
Accepted for integration with TCRs.
- Done Provide a channel how Explorer can obtain only some subnodes for a node
- Done Enhance FilterNode to do delegate effectively, lazily to the underlaying node
- Future: Provide API for other operations (like quick search) to be lazily computable, e.g. computable without need to create all the Nodes
- Done: Rewrite FolderChildren to use this new API
- Done Make sure favorites view presents data lazily
- Done Make sure files view presents data lazily
- Done Make sure projects view presents data lazily
- TCR: Remove: public Children(boolean lazy)
- TCA: Make Children.Keys(...) protected
- TCR: Proper javadoc, apichanges
- TCR: Document different behaviour of createNodes in the new Children.Keys constructor
- TCA: Rewrite ListView to be lazy as well. Test it on different L&Fs, TCA
- TCR: Test with different heights of Nodes in TreeView, See DirectoryChooserUI.createTree
- TCR: property to allow both behaviours of FolderChildren
Pay only for what you see!
Many software systems trade effectiveness for laziness. With the goal to make programmers life simpler they sacrifice user experience. Instead of doing only things that are important to the user, they create unnecessary load on the user system by overusing CPU and memory for actions that need not be computed at all. This kind of laziness is horribly bad and ineffective, because at the end, there is one writer of the code and thousands of users, using the program day by day, requiring their computer to waste its own important resources as well as user's own time, for useless jobs.
On the other hand, there is a different kind of laziness. If we invest a bit of our developer thoughts into more powerful and better organized data structures, we can instruct the computer to perform only the necessary set of operations, that will satisfy the user, nothing more. In some sense we increase the computer's laziness. This kind of laziness is through-fully positive term as it allows the computer to do less, while doing enough. Instead of wasting time computing something useful, the CPU can be dedicated to provide more useful functionality to the user. This is kind of laziness that we want to seek and increase for Fitness effort.
One of the screaming examples where laziness is desperately needed is explorer. The explorer (projects, files, favorites, etc.) is a view that provides unified look to various complicated internal data structures, presenting them as a tree structure of nodes with additional properties. However, currently this view is not lazy at all. In order to display just a few nodes, all the internal data structures need to be computed. This is horribly inefficient and negatively affects user experience, as although the user sees just a few elements, all of the data behind need to be computed. We need to improve all the appropriate data structures to allow "lazy" exchange of necessary data.
Speed up expanding of a node in Project, Files and Favorites view representing a folder with 1000, 2000, 3000, etc. files to perform constant amount of operations and take constant amount of time.