1. Summary
Enhance the Neo.core.Effect system (or provide a utility around it) to support memoization for VDOM-generating methods. This will significantly improve rendering performance by caching the VDOM output and preventing unnecessary re-executions when component configs (inputs) have not changed.
2. Rationale
Functional components, driven by Neo.core.Effect, re-generate their VDOM whenever a tracked config changes. While efficient, re-generating complex VDOM trees can still be computationally intensive. By memoizing the output of pure VDOM-generating methods, we can avoid redundant work. If the inputs to createVdom() are the same as the last execution, the cached VDOM can be returned directly, bypassing the VDOM generation and worker communication steps.
3. Scope & Implementation Plan
- Memoization Mechanism: Design and implement a caching layer for
Neo.core.Effect instances (or a new MemoizedEffect class). This mechanism will:
- Store the last computed VDOM output.
- Efficiently compare current inputs (tracked configs) with previous inputs to determine if re-execution is necessary.
- Invalidate the cache when inputs change.
- Integration: Determine how developers will opt-in to memoization (e.g., a config on
FunctionalBase, a decorator, or a utility function).
- Performance Testing: Create benchmarks to measure the performance gains achieved through memoization, especially for components with complex VDOM structures or frequently updated but unchanged inputs.
4. Definition of Done
- A memoization mechanism for
Neo.core.Effect is implemented.
- Functional components can leverage memoization to improve rendering performance.
- Performance benchmarks demonstrate measurable gains.
1. Summary
Enhance the
Neo.core.Effectsystem (or provide a utility around it) to support memoization for VDOM-generating methods. This will significantly improve rendering performance by caching the VDOM output and preventing unnecessary re-executions when component configs (inputs) have not changed.2. Rationale
Functional components, driven by
Neo.core.Effect, re-generate their VDOM whenever a tracked config changes. While efficient, re-generating complex VDOM trees can still be computationally intensive. By memoizing the output of pure VDOM-generating methods, we can avoid redundant work. If the inputs tocreateVdom()are the same as the last execution, the cached VDOM can be returned directly, bypassing the VDOM generation and worker communication steps.3. Scope & Implementation Plan
Neo.core.Effectinstances (or a newMemoizedEffectclass). This mechanism will:FunctionalBase, a decorator, or a utility function).4. Definition of Done
Neo.core.Effectis implemented.