0

I'm in the process of writing a jQuery plugin, and am getting into some fairly heavy operations, which is making my plugin slower and less responsive. I was wondering if there was any tools out there that would help me optimize my JavaScript?

3 Answers 3

8

I recommend using Firebug's "profile" tab as a start.

Just click the profile tab, then use your plugin for a while and then click the profile tab again. You'll then see a report of what functions were called and how much time each one took.

Then, I recommend the article Speed up your JavaScript

As outlined in the article, why a script can take too long to execute

  1. Too much happening in a loop.
  2. Too much happening in a function.
  3. Too much recursion.
  4. Too much DOM interaction.

I have not yet found a tool that automatically optimizes or refactors JavaScript for speed. It's always been a manual process for me.

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

Comments

2

This Google Talk video goes into a lot of useful detail...

http://www.youtube.com/watch?v=mHtdZgou0qU

Comments

0

Its difficult to say without looking at at any code, ie how efficiently things have been written eg: how you're using selectors to find elements etc.

Have a look at some jQuery tips and tricks blogs.

eg:

http://viralpatel.net/blogs/2009/08/20-top-jquery-tips-tricks-for-jquery-programmers.html http://www.tvidesign.co.uk/blog/improve-your-jquery-25-excellent-tips.aspx

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.