...

View Full Version : How is CSS load time determined?



Sammy12
11-14-2011, 02:00 AM
I was wondering how css load time is determined? Let's say I had a 10,000 line css document, I'm wondering what would be the fastest way to structure it for it to load. (I know there are css compactors online) Can someone who really understands css load time answer these questions with: 1st faster, same, or 2nd faster

(1st faster)


a { color: #DDD; }



a {
color: #DDD;
}


Which one is faster?


a { color: #DDD; }



a { color: #DDD; }


Which one is faster?


a /* hi, i am a comment */ { color: #DDD; }



a { color: #DDD; }


Which one is faster?


/* Hello
I am a comment
*/



/* Hello I am a comment */


Thanks guys! I'm very curious to know whether comments and blank space effect load time.

Sammy12
11-15-2011, 02:31 AM
bumping

Apostropartheid
11-15-2011, 10:58 PM
It will be negligible at best. Format it in the easiest way to edit.

Sammy12
11-16-2011, 12:43 AM
interesting. what if my website was facebook? whould the difference still be negligible?

tracknut
11-16-2011, 01:26 AM
The savings one way or the other will be minute. But if you're concerned about speed, no reason to put extra spaces, semicolons and returns into a file, unless it makes it confusing or harder to manage. So if it were me, I'd be formatting like:


a {color:#DDD}


And using comments formatted for easiest reading (i.e. not trying to compress them, because after all, the best readability is the whole point behind a comment).

Dave

Sammy12
11-16-2011, 01:35 AM
so I'm guessing it's determined by how much "space" you use, all the white space also counts

Thanks!

tracknut
11-16-2011, 03:29 AM
"space" must be first downloaded to the client system, then must be parsed through and thrown away. So you're hit twice for it.

Dave



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum