Cache parsed components for 10x faster startup (2s → 200ms)
- Fix O(n²) postprocessing: compute_all_deps/io_refs/hash were called per-file (92x for sx app). Now deferred to single finalize_components() call after all files load. - Add pickle cache in shared/sx/.cache/ keyed by file mtimes+sizes. Cache stores fully-processed Component/Island/Macro objects with deps, io_refs, and css_classes pre-computed. Closures stripped before pickle, rebuilt from global env after restore. - Smart finalization: cached loads skip deps/io_refs recomputation (already in pickle), only recompute component hash. - Fix ~sx-header → ~layouts/header ref in docs-content.sx Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -118,6 +118,11 @@ def create_base_app(
|
||||
setup_jinja(app)
|
||||
setup_sx_bridge(app)
|
||||
load_shared_components()
|
||||
# Finalize shared components (deps, hash) now — service apps that call
|
||||
# load_service_components() will re-finalize after loading their own.
|
||||
from shared.sx.jinja_bridge import _rebuild_closures, _finalize_if_needed
|
||||
_rebuild_closures()
|
||||
_finalize_if_needed()
|
||||
load_relation_registry()
|
||||
|
||||
# Load defquery/defaction definitions from {service}/queries.sx and actions.sx
|
||||
|
||||
Reference in New Issue
Block a user