Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Combining JS?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Combining JS?

NoxterNoxter Member
edited April 2013 in General

I have 8 JS (40 KB total) that load on a current project and was wondering if grouping them was really beneficial. From my testing, start render was increased combining them. Were my experiences unique? Have you experienced different?

Comments

  • Combining them means it can potentially compress better, only needs to make 1 call to be fetched (loading 40KB at once is faster than loading 8 5KB files). It'll also be easier for the cache.

  • NoxterNoxter Member
    edited April 2013

    Yup, it's down to open connections. Don't think compression makes a difference when it's already compressed to all hell (minified/served compressed).

    Problem is, start render starts sooner when spread out in multiple connections than downloading an entire 40KB file on a single connection.

  • NoxterNoxter Member
    edited April 2013

    image

    Start render is at the underline. Don't have a screenie for the single request but it starts a bit later.

    I think combining JS/CSS was more important back when browsers didn't support multiple connections.

    Also, I lied, it's 11 not 8.

  • Not all browsers can parallel download resources efficiently. You combine js in 1 batch then css in the other and the 2 parallel download. Usually the most older browsers can handle.

    Where it starts rendering also depends on a lot of other things such as how your other resources are ordered etc.

    Whilst waiting for these bundled js/css, you can also start loading images in parallel.

  • use webpagetest.org and gtmetrix.com instead of pingdom tools page test and see

  • NoxterNoxter Member
    edited April 2013

    Going to give it a shot again.

    @eva2000 said: use webpagetest.org and gtmetrix.com instead of pingdom tools page test and see

    I do... I use almost every resource that'll show a waterfall.

    So I take it you folks have noticed a difference in start render (those with testing experience)? I just don't see it.

  • @Noxter said: So I take it you folks have noticed a difference in start render (those with testing experience)? I just don't see it.

    Start rendering doesn't mean everything. That's your 1st problem.

  • @concerto49 said: Start rendering doesn't mean everything. That's your 1st problem.

    I don't have a problem, boss. Honestly, I would rather speak with someone that understands and practices basic optimization. You clearly lack this (both CloudShards and VPSUpgrade are proof of this). I don't want to hear theories, I want to see hard evidence... an educated discussion.

    Forget I asked ;). Cheers.

  • @Noxter said: I don't have a problem, boss. Honestly, I would rather speak with someone that understands and practices basic optimization. You clearly lack this (both CloudShards and VPSUpgrade are proof of this). I don't want to hear theories, I want to see hard evidence... an educated discussion.

    Trying to help and yes providing evidence. Those are clearly templates and something we're working on completely redesigning. However, it's all good if you don't like to take some friendly advice in trying to help. Instead you're aiming at personal attacks and not objectively the problem at hand.

    Cheers. Gives up.

  • @Noxter use apache + Mod-ruid2+ mod-pagespeed + xCache to optimize your js & css

  • NoxterNoxter Member
    edited April 2013

    @vRozenSch00n said: use apache + Mod-ruid2+ mod-pagespeed + xCache to optimize your js & css

    I only use straight nginx ;). This 500KB page (vBulletin with vBSEO) is loading in under 300ms from TX/NY (without AdSense or Google Analytics), including DNS lookup. Nginx is going to serve static files faster than any other consumer/open source engine.

    I agree on the Google PageSpeed (ngx_pagespeed, Google recently endorsed)... however that requires I recompile nginx... which isn't an option right now. Everything pagespeed does for you can be done manually, which I have done on this project. However, I do have other projects requiring the optimization but haven't gotten around to it.

    I'm going to combine all the JS/CSS and run it from EdgeCast. Might prove beneficial instead of serving from this particular server.

  • @concerto49 said: Those are clearly templates

    And?

  • @Noxter said : I only use straight nginx ;)

    It would be even faster if you place the nginx as a proxy in front of the above apache combination :)

    But since you use straight nginx, it is good to try the ngx_pagespeed. It will manage the js/css compression/combine automatically, it can even reduce jpeg quality, for a price of cpu power (adjustable), but it's worth it.

  • Even better when you compress them beforehand so there is no need to do that on runtime :)

  • Yep, I minify the files first, then on runtime it is just combining the file where it fits

Sign In or Register to comment.