Scripts from the server
One of the main themes over the last couple of chapters, has been performance. That's not an accident. Whether you're sending AJAX requests to the client from the server, or sending script files from the server to the client—whether you're executing synchronously, or asynchronously—it's important to always consider "what impact will this have on the user experience, can I improve that, and (if not), is it worth it?"
Often, a few-millisecond delay in processing is well worth the added or improved functionality that a given script might add, but even so, it's important to consider whether there is a more efficient way to accomplish the same end-goal. Lag, or non-responsiveness, is a cumulative frustration. Below are a few things to avoid in order to maintain a positive user experience. These are not strict rules that must always be followed, but they are general guidelines that, if you go against, you should carefully...