jquery / jquery/learn.jquery.com

Putting Performance In Perspective

Open
#99 2 comments 0 reactions 1 assignee View on GitHub

@johnkpaul is already working on this.

Since Oct 16, 2012.

Chapter: performance content
Dominant language
JavaScript
Stars
915
Forks
471
PR merge metrics
No merged PRs in 30d

Description

The internet is rife with all sorts of advice about performance, and jQuery and JavaScript performance in particular. Unfotunately, a lot of this filters down into a context-free echo chamber that has mixed-results in end-developer code. For instance, you'll see people who think nothing of nesting several AJAX calls, but then they'll end up doing a manual for loop over jQuery selections in in those nested callbacks because they "heard $.each was slow." We should breathe some sanity into this discussion and provide context for our other performance tips by explaining basic things like

  • importance of profiling
  • optimizing the things that will give you the biggest payoff/that have room for optimation (don't optimize the thing taking 1% of the time)
  • balancing performance with maintainability/readability
  • avoiding premature optimization, but also, what to prematurely optimize, e.g., caching jQuery collections is not only better because it's faster, but because it improves readability and code structure
  • library problems are likely different than your problems. in other words, if your app is slow, it's probably not because of scope chain traversal
  • if the only thing slow about your app is the overhead of $.each, have a Diet Coke

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.