Jump to content
Sign In to follow this  
Guest thetorpedodog

On Saving Bandwidth

7 posts in this topic Last Reply

Highlighted Posts

Guest
Posted:
Last Online: A long, long time ago... 
 

I've noticed browsing the forums that they can sometimes be rather slow. Knowing how your bandwidth metering works (you're charged for throughput), I found one solution that can quickly axe nearly eight kilobytes per forum page: linking an external stylesheet for the main forum styles.

I don't know if this is a forum-programming dependent thing, but right now, your forum styles live in a huge block at the top of the page. This means that every time a page is loaded, they are too. It'd be far more economical to create a file named, say, forum.css in the root directory and then linking to it using <link rel=stylesheet type=text/css href=/forum.css>.

This particular page (the post reply page) is almost exactly fifty kilobytes. Cutting that down by 1/5 would help your situation significantly, and it even would help on the larger threads: I'd imagine it's like shaving several posts off of each page, except with no drawbacks (or posters annoyed that you got rid of their posts)!

Cheers!

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

Thats the design information of the forum....you cant just cut down the size of it.
there's one way to cut the size from the stylesheet, only if you erase the information in them...that would make the forum design fuzzy or may destroy the design alignment

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

I believe what he is referring to is a method that is already being used on many message board softwares and websites.

You use the same HTML tag on every page that links to a stylesheet which loads the stylesheet from there rather than loads it along with the page.
I can only see this making things slower as it would put more load on the server because it would have to load two files instead of just one.

Share this post


Link to post
Share on other sites
Guest
  • Original Poster
  • Posted:
    Last Online: A long, long time ago... 
     
    7/17/2005 11:56:32 PM EDT (presumably) General Gunfire

    You use the same HTML tag on every page that links to a stylesheet which loads the stylesheet from there rather than loads it along with the page.


    I can only see this making things slower as it would put more load on the server because it would have to load two files instead of just one.
    quote>

    There's two hitches to your idea. Firstly, the stylesheet would need not be dynamically generated. Secondly, and most importantly, nearly all clients would cache the stylesheet. This means that it would not be loaded every time, but only on the first request made over a certain period before it expires.

    Otherwise, most major sites would not be using this. Look at Mozilla 's website, HTML Dog , Zeldman , or others.

    This forum already links two different stylesheets and five different Javascripts (at least on the reply page). All of these are cached.

    It's just like linking an image, except rather than sending image/? data, it's sending text/css or text/javascript.

    Redesigning with CSS would be helpful too, but that'd take significantly more effort, and would be too hard to just explain in a simple topic like this 2.gif. Read your A List Apart . :D

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Most browsers would cache it, you're right. But the script would still call for the server to load it, which will take another process by the CPU as it still has to request the page according to the script. Even if it is cached on the browser, the server must make that process if the script calls for it.

    Now, it would be more conventional to write a script which would call for browser info and find out if it is already cached before loading the page.1.gif

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    This seems like a good idea. Site designers are being encouraged to use this method. If it is possible to use on ST, evn thought it may seem like a small thing to do, I'm sure it would make a speed difference.
    :edit:
    A List Apart rocks! I have the live feed from that in my bookmarks.

    Share this post


    Link to post
    Share on other sites
    Guest
  • Original Poster
  • Posted:
    Last Online: A long, long time ago... 
     
    2005-07-18 03:27:12 EDT (presumably) General Gunfire

    Even if it is cached on the browser, the server must make that process if the script calls for it.

    quote>You don't quite get it. It would not be a dynamically generated page. The forum already links three stylesheets, all of which are cached by most browsers, and if it's not, all the retrieval stuffs happen automatically. No script would be needed. The browser would automatically handle caching, and the massive resources saved by those who do would dramatically offset the need to spawn a new thread to send the new stylesheet, which would not be dynamically generated.

    The <link /> replaces the inline styles, which cannot be cached. It's just like linking an image, except that it's text data.

    EDITED because the forum ate my post

    Share this post


    Link to post
    Share on other sites

    Sign In or register to comment...

    To comment in reply, you must be a community member

    Sign In  

    Already have an account? Sign in here.

    Sign In Now

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account

    Sign In to follow this  

    • Recently Browsing   0 members

      No registered users viewing this page.

    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections