Friday I spent some time refactoring an AngularJS application that I've been working on for the last few weeks. My refactoring centered on 4 pretty specific areas:
- wrapping all of my AngularJS code in IIFEs,
- rearranging my controller code so that I eliminated virtual functions in favor of assigning functions to members by the same name in my controller,
- cleaning up any issues by adding "use strict;" to all of my js files in the appropriate places and
- eliminating the use of a global app variable. All went well and introduced fewer issues than I originally expected.
After I completed the above work, I was astonished by the performance boost it apparently gave my app. The app uses Angular Material fairly heavily and the AM components that seemed to be somewhat sluggish were noticeably snappier. Is this type of performance boost to be expected?