Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

perf improvements #1

Open
ehynds opened this issue Dec 2, 2011 · 1 comment
Open

perf improvements #1

ehynds opened this issue Dec 2, 2011 · 1 comment

Comments

@ehynds
Copy link

ehynds commented Dec 2, 2011

Hi, there are a couple of things you could do to improve performance of this script:

  1. Don't store state as a class on the body. Hitting the DOM is expensive. Just store it in a variable, unless of course you want to expose each state to CSS.
  2. Cache your jQuery selectors outside of the setInterval and for loops.

<3

@ehynds
Copy link
Author

ehynds commented Dec 2, 2011

One more. No need to re-sort the breakpoints on each interval iteration.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant