MyBB Community Forums

Full Version: Perfomance, load scripts after the page has loaded
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Why don't we move all of the scripts to the bottom of the page.

It's made such a difference on my MyBB forum. Before doing this, it was taking 2-5 seconds to load a page.

I also have another non-MyBB forum (vBulletin) on exactly the same server, and it wasn't taking as long! (so it wasn't mySQL request that were the limiting factor)

I've since changed the MyBB site so it uses the CDN network and now no longer has any scripts in the head. The site seems to load so much faster now, all of the scripts load AFTER the page is visible, as they should, so the user experiences a much faster forum... why doesn't MyBB do this as standard ?
... because the web standard is to include scripts (assuming you mean JS) in the <head> tags? 2-5 seconds is a huge amount of time to load a page - it's either an issue with your host, a plugin and/or your internet connection.
(2010-12-04, 03:34 AM)Scoutie44 Wrote: [ -> ]... because the web standard is to include scripts (assuming you mean JS) in the <head> tags? 2-5 seconds is a huge amount of time to load a page - it's either an issue with your host, a plugin and/or your internet connection.

Actually, it's recommended to include only stylesheets and meta tags in the header and putting the JS before the end of the body. The reasoning is that, while it doesn't speed up pages, it creates an illusion because everything else is loading before the hefty Javascript files.
Many scripts require them to be in head tag in order to work. So your suggestion is pointless. It's likely that you have stuff not functioning properly on your site and you've not noticed that yet.
(2010-12-04, 10:04 PM)Ferron Wrote: [ -> ]
(2010-12-04, 03:34 AM)Scoutie44 Wrote: [ -> ]... because the web standard is to include scripts (assuming you mean JS) in the <head> tags? 2-5 seconds is a huge amount of time to load a page - it's either an issue with your host, a plugin and/or your internet connection.

Actually, it's recommended to include only stylesheets and meta tags in the header and putting the JS before the end of the body. The reasoning is that, while it doesn't speed up pages, it creates an illusion because everything else is loading before the hefty Javascript files.

Oh, pooh. Toungue

Perhaps OP's browser wasn't caching the page properly..?
(2010-12-03, 03:58 PM)Tenants Wrote: [ -> ]Why don't we move all of the scripts to the bottom of the page.

It's made such a difference on my MyBB forum. Before doing this, it was taking 2-5 seconds to load a page.

I also have another non-MyBB forum (vBulletin) on exactly the same server, and it wasn't taking as long! (so it wasn't mySQL request that were the limiting factor)

I've since changed the MyBB site so it uses the CDN network and now no longer has any scripts in the head. The site seems to load so much faster now, all of the scripts load AFTER the page is visible, as they should, so the user experiences a much faster forum... why doesn't MyBB do this as standard ?

We'll be moving scripts to the bottom in 2.0. Smile

@OP: Good suggestion Smile
oowf.. far too many negative comments for me to respond to Wink

Thank you, that's good to here Chris Boulton, so many forums applications seem to be behind! I've yet to see any forums that abide strongly to Best Practices for Performance, it would be good if MyBB gets there 1st:

http://developer.yahoo.com/performance/rules.html
(and old source, but still new to some)

The number of scripts, the number of images, script positioning and would you believe it, non-minified scripts are often where most forums fall over (all easily solved). Pingdom tools / Firebug are often good tools to give away the tell tell signs

I'm using MyBB since it looks easy to strip down / re-write, I'm planning to go all the way. Many of the performance tweaks that I will do will make a tiny difference, but every milli second counts on a forum...

It's so much more enjoyable flicking through the posts of a forum, thread after thread without having to wait, and many performance issues are just down to design.

In this case, script positioning is easily solved (I've done it, so anyone can Wink ) This idea of loading scripts last can be taken further, but I'll try not to ramble about it here.

Hoping for a fast MyBB future Big Grin
... my points still stands, though, you have internet issues if it's taking 2-5 seconds to load a page. Heck, NanoSkinners with it's heavy theme loads from scratch (after clearing cache) in 4 seconds, and is readable after caching in under a second.

I mean I'm all for increasing speed even more, but MyBB isn't remotely close to slow by any standards really.
Uh ha (3rd party tools) a few passes with pingdom tools removes uncertainty of testers own environment (and I'm not looking at cached performance, since thats of no help to 1st time visitors)
Pages: 1 2