1

All of my web pages use a JavaScript library, to improve the performance of my web page, I'd remove all the unnecessary functions/objects from the library for each page according to what's needed for those individual pages. I'm looking for a tool that can do the intelligent stripping automatically.

Or in the opposite direction. it will do also to have a tool to extract only the really needed functions and objects from a JavaScript library for a particular page.

Thanks for your help,

Yu

1
  • 1
    Stripper? Hey, this is a family site! Commented Aug 10, 2009 at 21:09

3 Answers 3

5

This sounds like very premature optimization to me. Have you verified the mere presence of the library functions you aren't using are causing performance problems? I would be very surprised if that is truly the case.

As always, code first, only optimize after you've recognized a performance problem, profiled and isolated the cause.

Sign up to request clarification or add additional context in comments.

Comments

4

Making several versions of your javascript library for different pages will defeat caching, and subsequent pages after the first page that users visit for the first time will take longer as it requests each page's version of the library than if there was one shared javascript library already in their cache.

Comments

0

I don't know of anything out of the box, but I would recommend at least first making sure that you're gzipping the output from the webserver, stripping out the whitespace, and forcing the browser to cache the javascript permanently. That way your users will download a smaller file once and not have to download it again. Of course if something changes, you'll need to change the url. You can do this automatically if you're regularly changing the file, or manually if you only make changes infrequently.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.