One of the most complicated screens in the application is the LeaseSchedule Screen. It contains 14 tabs and more than a hundred widgets. With all the SQL queries optimized, it still takes about 13 seconds just to bring up the screen !! The analysts want the screen to be loaded within 5 seconds. Now that’s asking for too much, right?
Well, we didn’t think so. We wanted to render the GUI independent of the model. This is where the idea of lazy loading came in. Firstly, we removed the use of the model in all the UI methods. We then initialized all the dependant models separately and collated them into a separate thread. Now, the UI would render separately and at the same time, the models would be created in another thread. With these changes the screen now loads in 2 seconds !! It actually loads in 3 stages which is clearly visible.
- The GUI is rendered with all the widgets, without any data.
- The data obtained from the model is populated into these widgets.
- The security features are applied to every widget.
The total time taken for the screen to be usable is still over 10 seconds, but the UI is rendered within 2 seconds. The user can now get to see the screen immediately, instead of waiting hopelessly without any visible response to the mouse/key events. I strongly recommend this approach for screens which need to display a lot of data.
But then came the final twist. We spoke to the client, telling him about the what we had achieved. He was very much impressed, but asked us not to implement this feature as of now, coz he perceived quite a few bugs to creep in due to these changes. Since we are very close to the end of the release, he told us that this would not be the appropriate time to incorporate these changes. We were told to document the approach, and probably implement it in the beginning of the next release.
After doing all this, it’s disheartening to revert all the changes. But I did learn quite a lot while doing this.
No comments:
Post a Comment