react / react/react

Compiler set intersections always iterate the first input

Open
#37,437 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
251k
Forks
51.4k
Avg merge
2d 4h
Merged PRs (30d)
53

Description

React version

Current main (2dc7da790d63).

Steps to reproduce
  1. Call the compiler utility Set_intersect with a large first set, another large set, and a very small later set.
  2. Count membership checks in each remaining input.
Current behavior

The utility checks remaining sets in their supplied order for every element of the first set. Its live compiler use intersects predecessor assumedNonNullObjects; when an early large predecessor is followed by a tiny one, most impossible candidates still incur checks against the larger set before the small set rejects them.

Expected behavior

Keep iterating the first set so result insertion order is stable, but probe the smallest remaining set first. Non-members then short-circuit before larger-set checks without changing intersection values or order.

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

Start by locating the compiler utility Set_intersect and its live use with assumedNonNullObjects. Exercise the case with a large first set and a tiny later set, then verify that the smallest remaining set is probed first while intersection values and insertion order stay unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
compilers, performance
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.