Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

An eager adoption pairs swapped or reordered raws across slots and aliases the two rows

Đang mở
#4,001 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
frontend, performance

Hướng nghiên cứu

Start in reconcile.ts, especially descend and adoptChild, and review the eager adoption examples described in the issue. The challenge is finding an O(1) way to preserve row identity for raws moved between slots without scanning or allocating; the issue notes that positional identity has different behavior from the held path. Done means swapped and reordered raws retain distinct proxies, including when only one row was proxied, while the immutable update case and reconcile performance remain acceptable.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

What happens

An eager (unheld) adoption that receives the same two raws swapped or reordered pairs each slot's existing row with the other raw, and the two rows alias after the commit. On next @ 49a765cc:

const A = { name: "a" };
const B = { name: "b" };
const [server, setServer] = createSignal({ x: A, y: B });
const [store] = createStore(() => server(), {});
createRenderEffect(createMemo(() => store.x.name + store.y.name), () => {});
flush();
// both rows are proxied now
setServer({ x: B, y: A });
flush();
[store.x.name, store.y.name]; // ["a", "b"] — unchanged; expected ["b", "a"] with two distinct proxies

The same holds for an unkeyed array reorder [A, B] to [B, A], and with only one of the rows proxied before the write.

Why

descend in reconcile.ts pairs slot x's target (A's) with B by position, which repoints the family lookup of B to that target; slot y then finds that target through B and pairs it with A again. A raw present in both frames moved, it did not change, and it should stay its own row. The held first-read pairing already follows that rule (#3986, ownRow in adoptChild).

What was tried on #3986

  • The rule on every eager pair (ownRow in descend): +5 B brotli, but a raw set per frame — CodSpeed measured -13% to -25% on the saturated reconcile benches.
  • The rule behind a once-per-frame scan for a proxied raw at a changed slot (hasRow): perf back within noise locally, +78 B brotli over the held-only form on createStore.

Both were reverted so the PR ships at +36 B. The tests for the eager cases are in the reverted commits (eae477f6, d20ce530 on fix/adoption-lazy-child-pairing-3712): a record swap and an unkeyed reorder, held and unheld, plus the one-row-proxied swap and the immutable update kept at its slot.

Open question

An O(1) way to tell "this raw is a row of the family at another slot of the incoming frame" without scanning the frame or allocating. Positional identity (the slot keeps its proxy, the lookup of the moved-away raw is dropped) would be O(1) but is the opposite identity choice from the held path's rule.


Generated by Claude Code

Ngôn ngữ chính
TypeScript
Star
36.1k
Fork
1.1k
Merge trung bình
10 giờ 44 phút
Pull request đã merge (30 ngày)
339

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của solidjs/solid

Tất cả issue của solidjs/solid

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.