Add timing for other app._compile events

This commit is contained in:
Masen Furer 2025-02-06 11:17:56 -08:00
parent 8e3962426e
commit f8eba338e0
No known key found for this signature in database
GPG Key ID: B0008AD22B3B3A95

View File

@ -999,6 +999,7 @@ class App(MiddlewareMixin, LifespanMixin):
should_compile = self._should_compile()
if not should_compile:
with console.timing("Evaluate Pages (Backend)"):
for route in self._unevaluated_pages:
console.debug(f"Evaluating page: {route}")
self._compile_page(route, save_page=should_compile)
@ -1027,6 +1028,7 @@ class App(MiddlewareMixin, LifespanMixin):
+ adhoc_steps_without_executor,
)
with console.timing("Evaluate Pages (Frontend)"):
for route in self._unevaluated_pages:
console.debug(f"Evaluating page: {route}")
self._compile_page(route, save_page=should_compile)
@ -1065,12 +1067,12 @@ class App(MiddlewareMixin, LifespanMixin):
custom_components |= component._get_all_custom_components()
# Perform auto-memoization of stateful components.
with console.timing("Auto-memoize StatefulComponents"):
(
stateful_components_path,
stateful_components_code,
page_components,
) = compiler.compile_stateful_components(self._pages.values())
progress.advance(task)
# Catch "static" apps (that do not define a rx.State subclass) which are trying to access rx.State.
@ -1154,6 +1156,7 @@ class App(MiddlewareMixin, LifespanMixin):
_submit_work(compiler.remove_tailwind_from_postcss)
# Wait for all compilation tasks to complete.
with console.timing("Compile to Javascript"):
for future in concurrent.futures.as_completed(result_futures):
compile_results.append(future.result())
progress.advance(task)
@ -1191,6 +1194,7 @@ class App(MiddlewareMixin, LifespanMixin):
progress.stop()
# Install frontend packages.
with console.timing("Install Frontend Packages"):
self._get_frontend_packages(all_imports)
# Setup the next.config.js
@ -1217,6 +1221,7 @@ class App(MiddlewareMixin, LifespanMixin):
# Remove pages that are no longer in the app.
p.unlink()
with console.timing("Write to Disk"):
for output_path, code in compile_results:
compiler_utils.write_page(output_path, code)