Skip to content

perf(mobile): reuse Linear ordering for list and board grouping - #20314

Merged
nwparker merged 1 commit into
mainfrom
nwparker/perf-mobile-linear-group-sorted
Sep 13, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/perf-mobile-linear-group-sorted

Conversation

@nwparker

@nwparker nwparker commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​82 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​74
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​117 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​111

ELI5

Mobile Tasks sorted Linear issues for the view, then sorted the same issues again for both list and board groups. Reuse the ordering the view already established.

What Changed

Add groupSortedLinearIssues with an explicit sorted-input contract and use it for the two view projections. Both grouping APIs reuse the existing grouping implementation. groupLinearIssues still sorts unsorted inputs. Keep memo dependencies, fresh result arrays, group metadata, input/object identity, and stable ties intact.

Why

The view already orders linearIssuesForView using the selected order. Grouping only needs to consume that sequence. This deletes two redundant sorts per projection without caching.

Counterbalanced full sort/list-group/board-group pipeline benchmark, macOS/Node 24, 8 pairs with 10 calls per arm and GC outside samples (wall medians):

1,000 issues Baseline This change With #20249 sorter With sorter + this change
Identifier 17.705 ms 14.023 ms 1.312 ms 1.043 ms
Updated 0.710 ms 0.318 ms 0.465 ms 0.236 ms
Priority 1.060 ms 0.658 ms 0.525 ms 0.297 ms

At 200 issues after #20249, updated ordering improves from 0.104 to 0.053 ms. These are Node computation measurements, not Hermes/device or rendered UI timings.

Linked Issue

User-requested performance audit; no linked issue. Independent baseline branch, not stacked on #20249. Both PRs touch the grouping module, view projection, and computation fingerprints; preserve both changes when reconciling them.

Visual Proof

N/A — pure computation change with identical sections, ordering, labels, and display behavior.

Testing

  • 11 tests passed: sorted grouping plus source-fingerprint suite. Covers all three orderings and five grouping modes, stable ties, invalid dates, empty/singleton input, preserved row identity, and independent result arrays. Sorted grouping performs no date parsing or collation; the unsorted API still sorts.
  • Original six source-fingerprint tests passed before edits. Updated only three computation hashes and declaration count (193→195); render tree, styles, runtime strings, hook count and statement count remain unchanged.
  • Mobile typecheck, mobile lint, benchmark regular/type-aware lint, formatting, and commit checks passed. Tests ran with ORCA_BACKGROUND_LAUNCH=1.
  • Reproduce actual-export pipeline parity/timing with node --expose-gc config/scripts/mobile-linear-group-sorted-benchmark.mjs 20ab9950654. Append nwparker/perf-mobile-linear-sort-keys to measure the incremental gain after perf(mobile): precompute Linear issue sort keys #20249.
  • macOS/Node only; no device or Electron launch. No RPC, provider routing, host ownership, workspace scope, or platform-specific changes.

Review

Self-reviewed the sorted-input guarantee, array ownership and unchanged memo dependencies. Desktop grouping has a different comparator and remains separate.

Agent skill upstream boundary

  • Not applicable; no upstream skill material copied.

Checklist

  • Small, focused, and explained
  • N/A visual proof with reason
  • Self-reviewed for correctness and performance
  • Cross-platform and remote impact considered
  • Focused tests, typecheck, lint passed; CI covers remaining checks/build

Merge order

Stacked on #20249, which follows #20233. Merge prerequisites first, then retarget this PR to main. Both sorting and grouping optimizations are preserved; 23 combined tests, lint, formatting and benchmark parity pass. Benchmark usage text is corrected.

@coderabbitai

coderabbitai Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 4abc0baf-7b16-4afa-8e8d-79a04358ad9c

📥 Commits

Reviewing files that changed from the base of the PR and between 15bd74d and 85028c4.

📒 Files selected for processing (12)
  • config/scripts/mobile-linear-group-sorted-benchmark.mjs
  • config/scripts/mobile-linear-sort-benchmark.mjs
  • config/scripts/mobile-task-sort-benchmark.mjs
  • mobile/src/tasks/mobile-linear-group-sorted.test.ts
  • mobile/src/tasks/mobile-linear-sort.test.ts
  • mobile/src/tasks/mobile-task-sort.test.ts
  • mobile/src/tasks/mobile-tasks-refactor-parity.test.ts
  • mobile/src/tasks/mobile-tasks-repository-presentation.ts
  • mobile/src/tasks/mobile-tasks-reviewer-linear.ts
  • mobile/src/tasks/use-mobile-tasks-picker-projection.tsx
  • mobile/src/tasks/use-mobile-tasks-provider-view-projection.tsx
  • mobile/src/tasks/use-mobile-tasks-task-list-loading.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • config/scripts/mobile-linear-group-sorted-benchmark.mjs

Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The change centralizes task and Linear issue sorting. sortLinearIssues and sortMobileTaskItems replace separate comparator logic. groupSortedLinearIssues handles already-sorted Linear issues. Task and Linear projections use the shared helpers. New tests validate ordering, grouping parity, stable ties, input isolation, and setup counts. Benchmark scripts compare baseline and current behavior.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 85028

The sorting and grouping refactor preserves the established ordering behavior and is covered by parity, grouping, and isolation tests.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.76% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 12 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description covers the change, rationale, testing, visual proof, scope, and checklist. However, the required Linked Issue section explicitly states that no issue is linked. Add a valid linked issue reference in the Linked Issue section, such as "Fixes #", or resolve the repository requirement for an always-linked issue before merging.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: reusing Linear issue ordering for mobile list and board grouping.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one copy/paste nit inline.

Reviewed changes

  • New sorted-input grouping API — groupSortedLinearIssues accepts a pre-sorted readonly LinearIssue[] and groupLinearIssues now delegates to a shared groupOrderedLinearIssues after sorting, in mobile-tasks-reviewer-linear.ts.
  • Both projection sites switched — linearIssueSections and linearBoardSections consume the already-sorted linearIssuesForView, removing the redundant sort per projection.
  • Tests & benchmark — new mobile-linear-group-sorted.test.ts plus updated refactor-parity hashes, and a standalone benchmark script.

Verified: focused mobile tests pass (11), check-changed-code-quality.mjs reports 0 findings across 5 files, and the benchmark runs clean with its assert.deepEqual(after, before) parity check intact across 25/200/1000 issues. Ordering equivalence holds because linearIssuesForView uses the same compareLinearIssues(..., linearOrderBy) comparator the old path used and sort is stable.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using openrouter/deepseek/deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker changed the base branch from main to nwparker/perf-mobile-linear-sort-keys September 12, 2026 07:41

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Grouping now composes with the batch sorter — this branch merged base #20249, and groupLinearIssues now delegates to the shared groupOrderedLinearIssues(sortLinearIssues(issues, orderBy), groupBy) instead of the old per-comparison compareLinearIssues.
  • Projection reuses the already-sorted view — linearIssuesForView is built with sortLinearIssues(items, linearOrderBy); both linearIssueSections and linearBoardSections call groupSortedLinearIssues and no longer re-sort.
  • Prior nit fixed — the benchmark usage string now names mobile-linear-group-sorted-benchmark.mjs, and its assert.deepEqual(after, before) parity check is intact.
  • Tests and parity hashes refreshed — the sorted-grouping test and benchmark switched to sortLinearIssues; the refactor-parity declaration count is 194 with updated statement/semantics/hook hashes.

groupSortedLinearIssues(sorted, ...) copies its input and both grouping paths share one implementation, so section order, ties, row identity, and array independence are preserved. check-changed-code-quality.mjs reports 0 findings across 12 changed files, and the previous review thread is resolved.

Pullfrog  | View workflow run | Using openrouter/deepseek/deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker force-pushed the nwparker/perf-mobile-linear-group-sorted branch from 85028c4 to b61b242 Compare September 13, 2026 03:44
@nwparker
nwparker requested a review from Jinwoo-H as a code owner September 13, 2026 03:44
@greptile-apps

greptile-apps Bot commented Sep 13, 2026

Copy link
Copy Markdown

Too many files changed for review (184 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

@nwparker
nwparker changed the base branch from nwparker/perf-mobile-linear-sort-keys to main September 13, 2026 03:45

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Board reuses the list sections for every grouping except none — linearBoardSections now returns linearIssueSections for grouped views instead of grouping linearIssuesForView a second time; none still builds its own status split for board columns.
  • Projection memos tightened — linearIssueSections and linearBoardSections drop the now-unneeded linearOrderBy dependency, and the board memo keys on linearIssueSections.
  • Test mock and parity hashes refreshed — the view-projection test mocks groupSortedLinearIssues and updates its work-count assertions to the single-grouping shape; refactor-parity hook/statement hashes and declaration count were refreshed.

Verified 28 focused mobile tests pass (use-mobile-tasks-provider-view-projection.test.tsx, mobile-linear-group-sorted.test.ts, mobile-tasks-refactor-parity.test.ts). The board/list identity sharing is safe: mobile-tasks-linear-list.tsx only reads sections, and the list still renders through linearListEntries, so no consumer mutates a shared section.issues.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nwparker nwparker closed this Sep 13, 2026
@nwparker nwparker reopened this Sep 13, 2026
@nwparker
nwparker merged commit df375cd into main Sep 13, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant