Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Can Javascript or Ajax codes affect the website performance?
Old 01-23-2010, 01:37 AM Can Javascript or Ajax codes affect the website performance?
Novice Talker

Posts: 10
Name: Junkeeper
Trades: 0
Hi guys,

1) In curiosity, can Javascript or Ajax codes affect the website performance? My website has a lot of ads like adsense, cpx, and I also use the Openx script. All of them running on javascript platform. On average, I have 4-5 ads per page. Will this increase my website loading time? Apart from the ads, I only use one single javascript code to implement my website's navigation menu.

2) My website loads pretty much the same speed as the other similar websites. But when I use the Pingdom.com's webtool to check the load test, I found out my website was categorized as Slow if compared to the others. Is it because I use plenty of javascript/Ajax (ads)?

Can anyone shed some light? Thank you.


Cheers,

Last edited by junkeeper; 01-23-2010 at 01:39 AM..
junkeeper is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-23-2010, 08:02 AM Re: Can Javascript or Ajax codes affect the website performance?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
depends how fast the remote servers that the scripts are coming from are and how good the the connection to them from the client viewing the page
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-23-2010, 10:07 PM Re: Can Javascript or Ajax codes affect the website performance?
Novice Talker

Posts: 10
Name: Junkeeper
Trades: 0
Hi chrishirst,

Thanks for the info. By the way, if you don't mind sharing with me what kind of webtool you're currently using to test your website loading speed? I'm using Pingdom right now but I wanted to test out others to see how well my website has been performed. I've checked using Alexa and I got another SLOW result. Grrrr.....

Cheers,
junkeeper is offline
Reply With Quote
View Public Profile
 
Old 01-24-2010, 08:21 AM Re: Can Javascript or Ajax codes affect the website performance?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
I don't! Why should the speed or efficiency of somebody else's Internet connection interest me?
I do not control that nor can I change it. I know how long it takes to generate my pages on the server and I control the byte size of the images as far as possible.
Beyond that, it is outside my control so it does not matter in the slightest.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-24-2010, 01:22 PM Re: Can Javascript or Ajax codes affect the website performance?
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
Your JavaScript can definitely affect the loading of your webpage and in several ways.

Every separate file that your page needs to load counts as an HTTP request, and that includes JavaScript, CSS, images, Flash, etc. The more requests you have, the longer it will take for the page to load. If a file does not originate on the same server as the page, it could take additional time to load because another server will need to be connected to in addition to your server.

The placement of JavaScript on your page may also affect the loading and rendering of other elements of your page. JavaScript acts as a blocking script, meaning that it will block other files from being loaded until it has finished. Older browsers will allow one or two simultaneous download, modern browsers will allow 6-8. If you have two or more JavaScript files in a row, they will block everything that comes after them in the code until they have been loaded for older browsers.

If you depend on JavaScript to render any part of your layout, your browser will not do it until that particular file has loaded and the proper browser event has been triggered.

Finally, if you're using any sort of framework like jQuery, MooTools, Prototype, etc., your JavaScript files have a tendency to be very large, which can significantly affect the page load time.

Solutions to these problems are fairly easy. First, minimize the number of HTTP requests by combining your CSS and JavaScript files. You won't be able to do that with your ad code, but you should be able to do it with the rest. Second, minify your JavaScript files. Third, Enable GZIP compression for your HTML, CSS, and JavaScript files. This can decrease your page load size by up to 80%. Fourth, compress your images and use CSS sprites where possible. There aren't too many layouts that couldn't be achieved with only 3-4 images if you're using sprites. Fifth, put your JavaScript files toward the bottom of your page code if at all possible. Sixth, use a lazy loading script to defer the loading of images below the fold.

I've found Firebug and YSlow (both plugins for Firefox) to be extremely helpful in this. I hope that helps answer your question. The YSlow blog in particular has some great resources for minimize page loading time, even more than I mentioned here.
__________________
Want new web resources every day? - Follow me on
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 01-24-2010, 09:04 PM Re: Can Javascript or Ajax codes affect the website performance?
Novice Talker

Posts: 10
Name: Junkeeper
Trades: 0
Hi VirtuosiMedia,

Thank you so much for your lengthly reply. I learned a lot from your post. I still have a few questions in my head, since you did mention about the Javascript, is it a good idea to embed a short javascript codes in between the html pages rather than combining all into one .js file?

Also, if the javascript are placed at the bottom of html source code, will this affect the flow of the script in case a function call is required during the middle of the page like form input validation?

Thanks,

Cheers,
junkeeper is offline
Reply With Quote
View Public Profile
 
Old 01-25-2010, 10:10 AM Re: Can Javascript or Ajax codes affect the website performance?
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
Quote:
Originally Posted by junkeeper View Post
Hi VirtuosiMedia,

Thank you so much for your lengthly reply. I learned a lot from your post. I still have a few questions in my head, since you did mention about the Javascript, is it a good idea to embed a short javascript codes in between the html pages rather than combining all into one .js file?

Also, if the javascript are placed at the bottom of html source code, will this affect the flow of the script in case a function call is required during the middle of the page like form input validation?

Thanks,

Cheers,
In general, I think it's better to combine it in one file, but the best way to find out for sure is to test it. You can use YSlow or a tool like Cuzillion to do that.

As for placing the code at the bottom of the page, form validation would be a perfect candidate for that because it's an action that won't be performed immediately on page load. JavaScript can manipulate any part of the page, no matter where it's placed. If you aren't relying on it to render your layout, I'd recommend putting it as far down as possible.
__________________
Want new web resources every day? - Follow me on
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 01-26-2010, 12:55 AM Re: Can Javascript or Ajax codes affect the website performance?
Junior Talker

Posts: 2
Name: anjellara
Trades: 0
Hello Everyone,
Yes definitely JavaScript and Ajax codes can affect the website performance.
JavaScript and Ajax are not installed in any browser.
Internet Explorer is JavaScript supported browser. But the rest are not.
For that first you have to download JVM(Java Virtual Machine).
And Ajax in not windows component so It is installed separately.
__________________

Please login or register to view this content. Registration is FREE
anjellara is offline
Reply With Quote
View Public Profile
 
Old 01-26-2010, 04:01 AM Re: Can Javascript or Ajax codes affect the website performance?
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Quote:
Originally Posted by anjellara View Post
Hello Everyone,
Yes definitely JavaScript and Ajax codes can affect the website performance.
JavaScript and Ajax are not installed in any browser.
Internet Explorer is JavaScript supported browser. But the rest are not.
For that first you have to download JVM(Java Virtual Machine).
And Ajax in not windows component so It is installed separately.
What the kaboozle are you talking about !!??

JavaScript is present in EVERY MAJOR BROWSER since the beginning of the 21st century. Only specific, often text based browser or cell phone browsers don't include them.
Ajax is a method of programming, not a program. You cannot install ajax, you can just use it.

IE was the first browser to integrate an xmlHTTPRequest object, and the mozilla foundation integrated it in mozill/firefox afterwards, which other did too (khtml, meaning safari and Chrome too) making it a defacto standard.

The JVM is needed to run JAVA APPLETS, not JAVASCRIPT.
Java and JavaScript are 2 completely different product that have very little in common, apart the keywords the language uses.

At least try to inform yourself before spreading ***** bull arse products like this.
You are just making yourself appears as a joke.
__________________
Only a biker knows why a dog sticks his head out the window.

Last edited by tripy; 01-26-2010 at 04:03 AM..
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to Can Javascript or Ajax codes affect the website performance?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30206 seconds with 12 queries