Just how slow are tables? (HTML)

Auryg

Platinum Member
Dec 28, 2003
2,377
0
71
Several users of my website have complained about the website running (not loading) slowly. The site was built on top of a fairly old script that used tables, and I never bothered to replace them with divs - could this alone be causing it?

I don't notice it on my computer but on an older computer it does indeed run bad, and I'm relatively sure it has nothing to do with the javascript I'm running. I got my hands on an old laptop to test things out tonight, but I figured I'd ask here first to see if anyone else has any ideas.

The Website
Thanks!
 

PhatoseAlpha

Platinum Member
Apr 10, 2005
2,131
21
81
While there are many reasons people look down on tables, speed has never been one I've heard of.

Do you have any onload scripts? Your page is loading an image, http://www.thesidehatch.com/wait.gif, which is not found, and that may be causing delays on onload scripts.

Other then that, you've got an image heavy page with scripts from multiple sources, flash animations - there are an awful lot of suspects.
 

Aluvus

Platinum Member
Apr 27, 2006
2,913
1
0
It's slow because you're loading a huge amount of crap. It's really as simple as that. Statistics from Yslow for Firebug:

Empty Cache

33.2K 1 HTML/Text
158.6K 2 Flash Objects
239.7K 18 JavaScript Files
19.8K 4 Stylesheet Files
23.1K 6 CSS Images
709.9K 51 Images

1184.7K Total size
82 HTTP requests

Primed Cache

33.2K 1 HTML/Text
0.0K 2 Flash Objects
14.9K 15 JavaScript Files
0.0K 3 Stylesheet Files
0.0K 6 CSS Images
16.8K 51 Images

65.0K Total size
78 HTTP requests

On the first visit, users have to wait for more than a megabyte of stuff to download. And while Javascript is not the only issue, it certainly is one of the issues. Setting up GZIP will at least reduce the amount of data transfer some, but won't help with the images or the very high number of HTTP requests.
 

Auryg

Platinum Member
Dec 28, 2003
2,377
0
71
It's pretty hard to run a flash game site that's not heavy on the images. I think some of the javascript files aren't minified right now, so I'll have to get on that. I'm not too concerned right now about the actual page loading time right now though (although it is an issue) - it's just in IE, and to a lesser extent Firefox, can be so slow in..rendering?..the page that it makes scrolling choppy, at least on a slow computer. Chrome is fine. I thought it started happening when we were running a lot of transparent .pngs (this was back before the way the site currently looks), but I got rid of the great majority of them and it's still doing it.
 
Oct 27, 2007
17,009
5
0
The page is over 1mb, which will make it load slow. It's covered from head to toe in Flash, Javascript and lots and lots of images, making it feel sluggish when scrolling and interacting. Nothing to do with the tables.

By the way, it's a great looking website, well done on the graphic design.
 

Auryg

Platinum Member
Dec 28, 2003
2,377
0
71
Thanks..too bad that makes it run so slowly!

So any other suggestions on what I can do then, without sacrificing stuff?
 
Oct 27, 2007
17,009
5
0
Performance is always a sacrifice unfortunately, I'm not sure there is much you can do without losing some of the neat Javascript or Flash. I'm not a web programmer so I won't make any specific suggestion but I'm sure there are some JS experts around here willing to help out.
 

troytime

Golden Member
Jan 3, 2006
1,996
1
0
tables won't slow you down, those images will though.
i'm sure you could knock down those filesizes quite a bit.
 

JasonCoder

Golden Member
Feb 23, 2005
1,893
1
81
I've seen tables slow down older versions of IE. IIRC, mostly it happened when you had crazy amounts of nested tables. Something about the internal handling of tables in IE being inefficient enough to use up a bunch of memory on the aforementioned crazy tables.

Not sure if they fixed that or what in recent versions. Also not sure about the table haters. Not everything HAS to be in a <DIV></DIV>. Some things, like, say, data, makes sense to be in a table.
 

Atheus

Diamond Member
Jun 7, 2005
7,313
2
0
First off, I don't see why the top banner has to be Flash - you can have the rollover menu items in plain CSS, and the tiny amount of animation on the ninja dude doesn't really add anything to the site. I'd suggest you take a still screen of that image then compress it down to normal web quality and use that.

Secondly, I haven't read through the code, but am I right in thinking you're making an AJAX request every time a user rolls over one of the game icons? Why? The user isn't submitting any input - is there any reason you can't just load all the descriptions at once and put them in an array or something? I'd be very surprised if the whole lot was more than 10k. If you did that you wouldn't even have to load the jquery library and all that other stuff, just one little script for the DHTML popup box. Whats more people wouldn't be thrashing their network every time they move the mouse.

Thirdly - and I don't want to interfere with your design, which is good - but do I as a user really need six (six?!) different ways to select a game on the front page? You've got the categories at the top, then the 'newest games', the 'most popular' games (all AJAX), a massive flash box with screenshots of a whole bunch of games on the right, the 'select game' dropdown, and then the main categotized list. Why not just get rid of everything except the main list?
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
The suggestions of lowering the image quality, minimizing scripts, using compression, reducing the number of ajax calls (or making them in the background after the page has loaded and caching them), reducing the amount of flash (if you can write dhtml that is smaller) will all have good effects.

Another thing is I've found it is better to have 1 file with a lot of js in it then 10 files with a little js in them. It seems that if the total file sizes are the same the 1 file will load faster then the 10 files that equal the same size.
 

Snapster

Diamond Member
Oct 14, 2001
3,916
0
0
Originally posted by: sourceninja
Another thing is I've found it is better to have 1 file with a lot of js in it then 10 files with a little js in them. It seems that if the total file sizes are the same the 1 file will load faster then the 10 files that equal the same size.

I do this where possible, because of:

a - reduced overheard of less http requests
b - consistent/quicker stream of a larger download than multiple smaller downloads.

The same is also true of image sprites, except you can get even better size reduction as compression will be compounded.
 

Rangoric

Senior member
Apr 5, 2006
530
0
71
Originally posted by: Snapster
Originally posted by: sourceninja
Another thing is I've found it is better to have 1 file with a lot of js in it then 10 files with a little js in them. It seems that if the total file sizes are the same the 1 file will load faster then the 10 files that equal the same size.

I do this where possible, because of:

a - reduced overheard of less http requests
b - consistent/quicker stream of a larger download than multiple smaller downloads.

The same is also true of image sprites, except you can get even better size reduction as compression will be compounded.

I was going to say image sprites and a server side JS script combiner (can't think of better way to say it). Only have the scripts that will be on every page be seperate (for caching).
 

Auryg

Platinum Member
Dec 28, 2003
2,377
0
71
Originally posted by: Atheus
First off, I don't see why the top banner has to be Flash - you can have the rollover menu items in plain CSS, and the tiny amount of animation on the ninja dude doesn't really add anything to the site. I'd suggest you take a still screen of that image then compress it down to normal web quality and use that.

Secondly, I haven't read through the code, but am I right in thinking you're making an AJAX request every time a user rolls over one of the game icons? Why? The user isn't submitting any input - is there any reason you can't just load all the descriptions at once and put them in an array or something? I'd be very surprised if the whole lot was more than 10k. If you did that you wouldn't even have to load the jquery library and all that other stuff, just one little script for the DHTML popup box. Whats more people wouldn't be thrashing their network every time they move the mouse.

Thirdly - and I don't want to interfere with your design, which is good - but do I as a user really need six (six?!) different ways to select a game on the front page? You've got the categories at the top, then the 'newest games', the 'most popular' games (all AJAX), a massive flash box with screenshots of a whole bunch of games on the right, the 'select game' dropdown, and then the main categotized list. Why not just get rid of everything except the main list?

The banner is eventually going to have roll over animations that the ninja does. Kids like stuff like that =/

The reason why the calls are ajax for the game icons is because users can scroll through them with the arrows, or order them through the categories - by all of the descriptions do you mean every one on the site? The current rating and games played for each one would need to be taken from the database for each game - wouldn't that really hurt my server? I use jQuery for other things anyways (the point system and the like).

The design we more or less took from several different flash game sites, taking what we liked on each one. I would say we took most of our inspiration from armorgames, at least in terms of what they have on each page. We might still change things around once the category pages are better but for now I think it's pretty good. I had taken out the dropdown box but a few users complained. One like to pick games at random..hey, there's an idea. Shuffle button!

Thanks for the ideas/suggestions though. It's giving me a lot to think about. What exactly is a server side JS script combiner? And is there a way to do image sprites automatically? There isn't much for images on the site other than the game images.
 

Auryg

Platinum Member
Dec 28, 2003
2,377
0
71
Originally posted by: VinylxScratches
Teh Win Prizes area doesn't look right in Safari fyi.

You mean where the prizes are listed? I just downloaded and tested it and it's working fine for me..how does it look on your end?
 

Atheus

Diamond Member
Jun 7, 2005
7,313
2
0
Originally posted by: Auryg
Originally posted by: Atheus
First off, I don't see why the top banner has to be Flash - you can have the rollover menu items in plain CSS, and the tiny amount of animation on the ninja dude doesn't really add anything to the site. I'd suggest you take a still screen of that image then compress it down to normal web quality and use that.

Secondly, I haven't read through the code, but am I right in thinking you're making an AJAX request every time a user rolls over one of the game icons? Why? The user isn't submitting any input - is there any reason you can't just load all the descriptions at once and put them in an array or something? I'd be very surprised if the whole lot was more than 10k. If you did that you wouldn't even have to load the jquery library and all that other stuff, just one little script for the DHTML popup box. Whats more people wouldn't be thrashing their network every time they move the mouse.

Thirdly - and I don't want to interfere with your design, which is good - but do I as a user really need six (six?!) different ways to select a game on the front page? You've got the categories at the top, then the 'newest games', the 'most popular' games (all AJAX), a massive flash box with screenshots of a whole bunch of games on the right, the 'select game' dropdown, and then the main categotized list. Why not just get rid of everything except the main list?

The banner is eventually going to have roll over animations that the ninja does. Kids like stuff like that =/

On the other hand, if you had a poll on the site which asked 'what would you rather have - a) fast/properly loading pages or b) animations on the ninja' I'm pretty sure I know what they'd choose. You've got to think about it like this: are you building the site because you want it to look cool, or are you building it to get the largest possible number of page hits?

The reason why the calls are ajax for the game icons is because users can scroll through them with the arrows, or order them through the categories - by all of the descriptions do you mean every one on the site? The current rating and games played for each one would need to be taken from the database for each game - wouldn't that really hurt my server? I use jQuery for other things anyways (the point system and the like).

Well how many games have you got? 100? 200? Lets say you have 200 games and the average description is 20 words, 2 numbers, and a date, which is about 150B give or take, and *200 its about 30KB in total for everything. You can get this data with a single database query like 'SELECT * FROM Games' and cache it.

In the current situation you're making a database query every single time a user rolls over a game, so if I look at a dozen before I play one you've got 12 (or whatever) queries taking place with all the padding jquerey puts around the data. This is totally hammering your server compared to the other option. From the user's point of view, if you used the first option, they wouldn't have to wait for that loading bar when they roll over a game, and they wouldn't have to load the jquerey library, which is actually bigger than the data itself.

The design we more or less took from several different flash game sites, taking what we liked on each one. I would say we took most of our inspiration from armorgames, at least in terms of what they have on each page.

Go back and have another look at armourgames - they've only got two flash boxes on the home page, both of which are very small (in bytes and in dimensions), and both of which are ads they don't control. All their menus are DHTML rollovers, and the game images/descriptions are very small - just as an example one of their game icons is 3.3KB, where some of yours are over 20KB! I can still load the categories in the bottom menu dyanamically, without a page load, but I don't have to wait becasue it's all cached.

The fact is that if you want to speed this thing up you're going to have to load less data and run less code. It's as simple as that. I actually think your site looks better than armourgames, but if you reduced the image sizes, upped the compression, reduced the flash, etc, I think it would look better still for being less busy. On the web, less is more. That's one of the main things I've learned since starting my business last year.

/edit: that'll be £1500 consultancy fee ;)
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,695
4,658
75
Your images on that page seem loaded down with metadata. I tried a program I use that runs jpegtran to optimize JPEGs, and frantic2.jpg went from 16.4K to 2.6K!

So get jpegtran and try running it with "-copy none -optimize" on those images. (-progressive is an option that can make an image compress better or worse. My code tries both ways.)
 

Auryg

Platinum Member
Dec 28, 2003
2,377
0
71
Thanks for all the tips everyone. I was wondering a good way to optimize the jpegs. I was just going to do a batch save in photoshop and make them all .gifs but your way will be much easier. I'm not quite sure how to code the site in order to have it load everything up front for the games, but I'll look in to it. I wish I could give you all a consultancy fee but at the moment I'm losing money from the site :p
 

EricMartello

Senior member
Apr 17, 2003
910
0
0
Proper usage:

CSS = formatting, dynamic layout elements
Tables = static layout elements

The CSS fanboys have convinced themselves that CSS is great for all layout and formatting, and that tables are obsolete. That is utter bullshit. While you can pull off 100% CSS sites, enjoy having to deal with each browser's interpretation of CSS.

Tables work and I use them quite often in websites I design, either exclusively or mixed with CSS elements. Tables do not "slow" a site down and even if they did, better to have a site that loads a tad slower while having a generally identical appearance across many browsers on many platforms. Any decent web designer will use a mix of tables and CSS.

Edit:

The reason your site is slow is, as others have pointed out, due to the large number of HTTP requests. You may be able to fix this by using imagemagick or GD functions to create a dynamic CSS sprite of all those thumbnails. This way you go from 50+ requests down to 1. Of course, CSS sprites are still "flakey" and may not work right on all browsers.