Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Oct 2002
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    File & structure optimisation.

    Hi,

    Just 5 multiple questions regarding file and structure optimisation, these questions concern download time and processor handling, which is best.

    1. CSS declaration external file:

    A. one line

    body{color:#ffffff;border:2px solid red;etc;}

    B. separate by <enter>

    body{
    color:#ffffff;
    border:2px solid red;
    etc;
    }

    C. other (please explane)


    2. array declaration:

    A. one line

    B. separate by <enter>

    C. other (please explane)


    3. number of files you request

    A. all declarations in one *.htm file

    style, javascript etc

    B. separate files

    *.htm
    *.css
    *.js

    C. other (please explane)


    4. Does a browser send a request to the server for a *.js-file which is downloaded before and still available in the temp i-net directory?

    A. Yes

    B. No


    5. See 4, does this count as traffic?

    A. Yes

    B. No

    Thanks for Your effort,
    Jerome

  • #2
    Regular Coder
    Join Date
    Nov 2002
    Location
    Bristol, UK
    Posts
    932
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: File & structure optimisation.

    Originally posted by Jerome
    Hi,

    Just 5 multiple questions regarding file and structure optimisation, these questions concern download time and processor handling, which is best.

    1. CSS declaration external file:

    A. one line

    body{color:#ffffff;border:2px solid red;etc;}

    B. separate by <enter>

    body{
    color:#ffffff;
    border:2px solid red;
    etc;
    }

    C. other (please explane)
    Hmmmm, I don't see that there would be much difference in how you lay out your CSS. Arguably, if you indented the CSS that would be two characters (newline and tab) rather than one (newline or space) to be parsed, but you are never going to notice a difference! I doubt you could even measure such a difference, except maybe if your CSS file was a couple of gigs in size!

    2. array declaration:

    A. one line

    B. separate by <enter>

    C. other (please explane)
    Same applies, really... although arrays tend to be tabulated more and hence there are extra characters to process. I would not expect there to be much of a difference - the same applies here as to the CSS.

    3. number of files you request

    A. all declarations in one *.htm file

    style, javascript etc

    B. separate files

    *.htm
    *.css
    *.js

    C. other (please explane)
    Well, this is a two-edged sword. It will take slightly longer to get multiple files, because each one has to be opened, read, closed, etc. however you will see a lot of plus points on the side of bandwidth, because each file, once downloaded, will not have to be downloaded again until it changes. As such, although on the first visit there may be a *tiny* extra penalty for multiple files, on subsequent visits the files will not even have to be read, saving you processing as well as bandwidth.

    4. Does a browser send a request to the server for a *.js-file which is downloaded before and still available in the temp i-net directory?

    A. Yes

    B. No
    I explained some of this in my answer to 3, however I should also go on to explain that, yes, technically a request is sent, however when the file properties are checked and the file is found to be the same, the file is not read or sent. Rather, the browser can then use its own cached file.

    5. See 4, does this count as traffic?

    A. Yes

    B. No
    Yes, the request itself counts as traffic (although very minimally) but as the file is not being sent (if it is cached) you will not have the file size added onto your traffic.

    Thanks for Your effort,
    Jerome
    No problem I would suggest that the best way is often the way which is most readable to you - although you may wish to "crunch" your files when they are published (removing uneccessary whitespace etc.) this is of aruable benefit unless you have a lot of whitespace. Most people do not care about the few extra bytes of bandwidth saved - although, when multiplied many times over, there is good arguement for it.

    ::] krycek [::
    ithium | SOAPI | SDP | PTPScript manual
    "ithium is a non-profit webhost, which is pretty much unique. The mission of ithium is to provide free hosting resources for worthwhile and needy non-profit projects, which otherwise may not be able to obtain such facilities. The money from commercial customers goes to maintain ithium's servers and further development."

  • #3
    Regular Coder
    Join Date
    Oct 2002
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks!

    By the way, excellent explanation.

    Jerome

  • #4
    Regular Coder
    Join Date
    Nov 2002
    Location
    Bristol, UK
    Posts
    932
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Heheh no worries I do what I can

    ::] krycek [::
    ithium | SOAPI | SDP | PTPScript manual
    "ithium is a non-profit webhost, which is pretty much unique. The mission of ithium is to provide free hosting resources for worthwhile and needy non-profit projects, which otherwise may not be able to obtain such facilities. The money from commercial customers goes to maintain ithium's servers and further development."


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •