
Originally Posted by
edspencer
This is a complex issue and one we need to think carefully about. The expected performance benefits often do not emerge from this technique due to the fact that network access is not free (e.g. there is latency and overhead involved in each http request).
In a large number of cases you're better off just bundling the component in one large request at the beginning and saving all the http overhead, latency and inefficient use of packets that come with lazy-loading.
For example if your network latency is 100ms and your network bandwidth is 5mbps (reasonable estimates for an office environment), then loading a 500kb file would take 900ms total. On the other hand, if you were to load just the essentials up front (call it 250kb), then load the 10 components you use on demand (say they're 20kb each), you've got a 500ms initial load time followed by 10 more requests that take 132ms each, totalling 1820ms.
Obviously the numbers above are rather arbitrary, and depend a lot on your network's performance characteristics, but it's clear that this isn't just an open and shut case. Ideally the minimal set of code would be built into an application-specific build of Ext JS and delivered on page load, providing a good middle ground between both strategies.