jquery / jquery/sizzle

[select] use for loop instead of `push.apply`

Open
#403 8 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Has a jQuery counterpart
Dominant language
JavaScript
Stars
6.3k
Forks
927
PR merge metrics
No merged PRs in 30d

Description

Migrated from https://github.com/jquery/jquery/issues/3704

We decided in the meeting to try a for loop instead of push.apply. Check perf to be sure, but for loops are so heavily optimized these days that it might even be better. It has the added advantage of not causing "stack limit exceeded" errors.

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.

Research direction

Locate the Sizzle code that uses push.apply and review the surrounding selector-engine logic. Compare the proposed for-loop approach for performance, then confirm the relevant path no longer risks stack-limit errors and that existing tests still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
performance, web-dev
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.