perf: cut dev-mode memory in the frontend and telemetry paths - #7112
Conversation
Set MIMALLOC_ARENA_EAGER_COMMIT=0 for the vite dev server and the export build so rolldown does not keep its dependency pre-bundling arena resident. Send telemetry through urllib so backend workers never import httpx on their first error, and import packaging lazily in telemetry. Measured on a blank app (PSS over the whole `reflex run` tree, page loaded once): node cold ~780 MB -> ~455 MB, warm ~415 MB -> ~335 MB. Claude-Session: https://claude.ai/code/session_015Gi5wTWZNBA61pVDdPLu8u
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Merging this PR will not alter performance
Comparing Footnotes
|
Summary
Two dev-mode memory reductions, measured on a blank app.
MIMALLOC_ARENA_EAGER_COMMIT=0for the vite dev server and thereflex exportbuild (exec.frontend_env()). Rolldown allocates through mimalloc, and with eager commit the arena it touches during dependency pre-bundling stays resident for the life of the dev server. A value already present in the environment wins._send_eventposts throughurllib.requestinstead ofhttpx, so backend workers never import httpx on their first error. Thepackagingimports intelemetry.pyare lazy.Measurements
PSS over the whole
reflex runtree, page loaded once in headless Chrome, 15 s settle, cold = no.web/node_modules/.vite.Python-side worker layout is unchanged here; #7079 covers forking.
Test plan
uv run pytest tests/units(8482 passed, 76.6% coverage)reflex export --frontend-onlybuilds with the new envhttps://claude.ai/code/session_015Gi5wTWZNBA61pVDdPLu8u