It is easy to shoot yourself in the foot when it comes to performance, using client side scripts. For this reason, it is generally good practice to move any complex processing, large requests (more than a hundred or so records), and multi-level dot-walking to server-side scripts such as business rules which can present the data to the client. This can be done in a few ways, such as by using GlideAjax. It's also a good idea to utilize callback functions in almost every case where you're doing record lookups client-side.
In this article, we'll go over some of the best ways to get the greatest client-side performance out of ServiceNow, by using good coding practices, callback functions, and GlideAjax to push some of the work off onto the server, rather than the client and prevent the client from having to wait around for the server to respond.
Read more