[nycphp-talk] So why is Ajax so fast?

Mark Armendariz enolists at
Fri Jan 12 12:50:27 EST 2007

It definitely depends on how you're utilizing Ajax methods.

On the client side, a page load including headers, tags, external files,
image / object loading, any onLoad javascript, etc can be a rather heavy
process for the browser as well as the network (firebug gives a good glimpse
of all of this).  If you're just loading a piece of data, say a JSON array
of the options in a select box, or a JSON array of information to create a
couple local form fields with, you're skipping LOTS of overhead and merely
replacing a small portion of an already built page.

As for the server side, for a full page load, you might find yourself
hitting the database 5 or 10 times.  Maybe even 150 times.  You're also
running includes/requires, template engine, likely an entire framework full
of tweaks, specialized queries and automation to build the page from data to
template to html.  Asking the server for a list of states in JSON format
should be far less a production.  Of course, the difference may be in a few
ms, but on a heavily trafficked site, few ms can be a lifetime.


More information about the talk mailing list