Skip to content

optimize asset checksum filtering with Set lookup#7105

Draft
EvilGenius13 wants to merge 1 commit intomainfrom
perf/asset-checksum-set-lookup
Draft

optimize asset checksum filtering with Set lookup#7105
EvilGenius13 wants to merge 1 commit intomainfrom
perf/asset-checksum-set-lookup

Conversation

@EvilGenius13
Copy link
Contributor

@EvilGenius13 EvilGenius13 commented Mar 25, 2026

WHY are these changes introduced?

We can improve performance around asset checksums.

WHAT is this pull request doing?

Optimizes rejectGeneratedStaticAssets in asset-checksum.ts from O(n²) to O(n) by pre-computing a Set of liquid asset keys.

Before: For each asset, hasLiquidSource() scans the entire array with some() — O(n) per asset, O(n²) total.

After: Pre-compute a Set of liquid asset keys once, then use O(1) has() lookups.

How to test your changes?

  • Pull down the branch
  • Build the branch
  • Run theme push, pull or dev and ensure everything is still working.

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Replace O(n) Array.some() scan with O(1) Set lookup by pre-computing
liquid asset keys. Reduces complexity from O(n²) to O(n) for themes
with many assets.
@EvilGenius13 EvilGenius13 changed the title perf(theme): optimize asset checksum filtering with Set lookup optimize asset checksum filtering with Set lookup Mar 25, 2026
@github-actions
Copy link
Contributor

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 82.22% 15042/18294
🟡 Branches 74.77% 7416/9918
🟢 Functions 81.3% 3791/4663
🟢 Lines 82.62% 14223/17216

Test suite run success

3970 tests passing in 1524 suites.

Report generated by 🧪jest coverage report action from 268291c

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