Skip to main content
GameDev.net gamedev.net
🔒 Locked

Performance: PHP vs AJAX

Started by SuperJman Dec 23, 2010 at 8:54 PM 3 replies 900+ views
Original Post
SuperJman
SuperJman
Hello everyone,

So here is the situation: I'm building a website that does NOT strictly require any features from AJAX. By this I mean that, minus the luxury of a more dynamic user experience, AJAX does nothing to significantly change my site. However, I've been diving into AJAX recently, and I'm wondering if you guys think it is worth the effort to learn/implement AJAX from strictly a performance standpoint. I've read many different opinions and just wanted a few more to make a decision.

Most importantly:
Will bandwidth use be significantly impacted by AJAX?


Thanks for any information,
~ SuperJman

P.S. Happy holidays gamedev!
alvaro
alvaro
Using AJAX will probably complicate things enormously. If you don't really need it, I would stay away from it.

The thread title is misleading: PHP and AJAX are not excluding alternatives. AJAX (a.k.a. "&#106avascript now works") requires client-side parts written in &#106avascript and server-side parts, which can well be written in PHP.<br><br>
Atrix256
Atrix256
Besides what alvaro says, it depends on how you use these things.

Quick question, the title of this topic is about performance, and you talk about bandwidth usage in your post. Which do you care about? And if performance, do you care about client side performance or server side performance.

No matter your answers it could go either way depending on how you used these things.

For instance if you really needed to minimize bandwidth usage for some reason...

1) Going ajax, you could conserve bandwidth by sending down only data that is needed instead of a full page refresh and your &#106avascript would know how to change the document (html) to show the new correct thing.<br/><br/>Conversely...<br/><br/>2) Going server side only logic with page refreshes can be more bandwidth efficient than if you used ajax to dynamically update the page with fluff that doesn't really matter (like help text when they choose different options from a drop down list) since it would just be the page refreshes instead of the page refreshes AND the ajax communication.<br/><br/>Similarly, client and server side performance can be both faster and slower by using ajax or page refreshes, depending on what you are doing.<br/><br/>Bandwidth and performance aren't the only concerns though, user experience is a big one so you should use whatever makes sense and is reasonable for your situation.<br/><br/>In a nutshell, deciding to use just server side PHP vs going Ajax isn't a performance or bandwidth decision.<br/><br/>It all depends on how you use it and what you want to achieve.<br/><br/>Hope this helps!
davepermen
davepermen
ajax only helps with bandwidth if the content is bigger than the ajax library you have to send down to the client (f.e. jquery currently is 26kb). so only once using ajax reduces dataloads by 26kb on a typical user session, you start to profit from it (except if you link to the jquery's own &#106avascript instead of your serverlocal copy, but i never do that).
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia
My Page davepermen.net | My Music on Bandcamp and on Soundcloud
SuperJman
SuperJman
Thank you very much everyone!

alvaro I understand that PHP and AJAX are not excluding alternatives, but I was attempting to make a distinction between a website lacking any AJAX and a website that is fleshed out with AJAX.

Regardless, thank you again for your information. In light of it all I'm probably going to keep away from AJAX and save some time.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.