Skip to content

Speed up deploy archive creation - #7450

Merged
masenf merged 1 commit into
mainfrom
farhan/deploy-zip-archives
Oct 14, 2026
Merged

masenf merged 1 commit into
mainfrom
farhan/deploy-zip-archives

Conversation

@FarhanAliRaza

@FarhanAliRaza FarhanAliRaza commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Split out of #7054 per @masenf's request to land the deploy speedups as separate, individually measured patches. This one only touches archive creation.

Changes

  • Resolve files_to_exclude to (st_dev, st_ino) pairs once, instead of calling Path.samefile() for every walked file and directory against every exclusion (and exists() on each exclusion every time).
  • Store the pre-compressed .gz / .br / .zst frontend sidecars in frontend.zip instead of deflating them a second time. Everything else, including every backend entry, stays ZIP_DEFLATED.
  • Tests cover the stored/deflated choice per archive, exclusion by file identity (hard-link alias), and exclusion through a directory symlink.

Measurement

build.zip_app() on an already-built .web (716 frontend files), 9 iterations × 2 processes, median:

main this PR
frontend.zip 0.237 s 0.184 s (−22%)
backend.zip 8.8 ms 8.4 ms
frontend.zip size 2,746,942 B 2,749,455 B (+0.09%)

The whole zip_duration phase of an export on this app is ~0.25 s, so this is a small absolute win; it is also the simplest patch in the set.

Measurement setup

Five-page app from the blank template (Radix Themes + Tailwind v4 plugins), Linux x86_64, 4 vCPU, Python 3.14, Node 22.22, npm 10.9, bun 1.4.2. Each run is a fresh interpreter calling reflex.utils.export.export() the same way reflex export does; durations are the phase timings the export already reports to telemetry (compile includes the dependency install). Medians of 3 runs unless noted. Vite dominates every export (~6.5 s); these numbers isolate the part this PR touches.

Type of change

  • Performance improvement (non-breaking)

Checklist

  • Tests added for the change; the full tests/units suite passes locally except the 14 reflex_bench/drivers/test_browser.py cases that need a Playwright browser launch, which fail identically on untouched main in this sandbox
  • ruff check, ruff format --check, codespell, and pyright reflex tests pass locally
  • News fragment added for every package touched

https://claude.ai/code/session_018nWB9r2HcC5tkT72UxWgGj


Generated by Claude Code

Review in cubic Turn on auto-fix

Resolve excluded archive paths to device/inode pairs once instead of calling
samefile() for every walked entry against every exclusion, and store the
precompressed .gz/.br/.zst frontend sidecars instead of deflating them again.

Split out of #7054.

Claude-Session: https://claude.ai/code/session_018nWB9r2HcC5tkT72UxWgGj
@FarhanAliRaza
FarhanAliRaza requested a review from a team as a code owner October 6, 2026 18:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T18:21:07.517158Z cfe56da PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cubic-dev-ai cubic-dev-ai 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 issues found across 3 files

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Optimizes archive creation with compression and exclusion logic.

The PR appears safe to merge; no actionable defects or repository-rule violations were found.

What we checked:

  • Backend files stay compressed: _zip_compress_type selects ZIP_STORED only for frontend entries with the listed suffixes. Backend entries still use ZIP_DEFLATED.

Summary

Speeds up deployment archives by resolving excluded file identities once and storing precompressed frontend assets without compressing them again.

  • Backend entries and other frontend files remain deflated.
  • Adds tests for compression choices, hard-link aliases, directory symlinks, and missing exclusions.
  • No actionable issues were found. Tests were inspected, not run.

Reviews (1) · Last reviewed commit: "Speed up deploy archive creation"

@codspeed

codspeed Bot commented Oct 6, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 4.67%

⚡ 1 improved benchmark
✅ 149 untouched benchmarks
⏩ 18 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_hydration_metadata[20] 217.1 µs 207.4 µs +4.67%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing farhan/deploy-zip-archives (cfe56da) with main (8b97272)2

Open in CodSpeed

Footnotes

  1. 18 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (62a56ba) during the generation of this report, so 8b97272 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@masenf masenf added on deck PRs lined up to review / merge next perf Performance-improving changes labels Oct 13, 2026
@masenf
masenf merged commit d02ba54 into main Oct 14, 2026
153 of 154 checks passed
@masenf
masenf deleted the farhan/deploy-zip-archives branch October 14, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

on deck PRs lined up to review / merge next perf Performance-improving changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants