Sign in to follow this  

Performance: PHP vs AJAX

This topic is 2549 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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. "javascript now works") requires client-side parts written in javascript and server-side parts, which can well be written in PHP.

Share this post


Link to post
Share on other sites
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 javascript would know how to change the document (html) to show the new correct thing.

Conversely...

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.

Similarly, client and server side performance can be both faster and slower by using ajax or page refreshes, depending on what you are doing.

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.

In a nutshell, deciding to use just server side PHP vs going Ajax isn't a performance or bandwidth decision.

It all depends on how you use it and what you want to achieve.

Hope this helps!

Share this post


Link to post
Share on other sites
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 javascript instead of your serverlocal copy, but i never do that).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 2549 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this