optimize asset checksum filtering with Set lookup#7105
optimize asset checksum filtering with Set lookup#7105EvilGenius13 wants to merge 1 commit intomainfrom
Conversation
Coverage report
Test suite run success3970 tests passing in 1524 suites. Report generated by 🧪jest coverage report action from bfca4c1 |
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.
268291c to
bfca4c1
Compare
|
We detected some changes at Caution DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release. |
There was a problem hiding this comment.
Pull request overview
Improves performance in the theme CLI’s checksum filtering by optimizing how generated static assets (e.g., assets/foo.css when assets/foo.css.liquid exists) are rejected during theme comparison/pull/upload flows.
Changes:
- Precomputes a
Setof Liquid asset keys underassets/for O(1) membership checks. - Replaces per-asset
some()scans withSet.has()lookups, reducing overall complexity from O(n²) to O(n). - Removes the now-unneeded
hasLiquidSourcehelper.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
WHY are these changes introduced?
We can improve performance around asset checksums.
WHAT is this pull request doing?
Optimizes
rejectGeneratedStaticAssetsin 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 withsome()— 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?
Post-release steps
Measuring impact
How do we know this change was effective? Please choose one:
Checklist