Skip to content

Commit b37b7d0

Browse files
feat: Add lazy initialization and feature service caching (#5924)
* feat: Add lazy initialization and feature service caching Implement performance optimizations for FeatureStore: - **Lazy Initialization**: Convert registry, provider, and OpenLineage emitter to lazy properties. Reduces cold start from 2.4s to 0.5s (5x improvement). - **Feature Service Caching**: Add caching layer for feature service resolution. Observed 19.6x speedup on cached calls during validation. Co-Authored-By: Claude Sonnet 4 <[email protected]> * fix: Add type annotations and formatting fixes for performance optimizations * fix: Clear feature service cache on registry refresh When refresh_registry() or plan() methods refresh the registry, the feature service cache must be cleared to avoid serving stale cached results. - Add _clear_feature_service_cache() helper method - Clear cache in refresh_registry() and plan() methods - Prevents data consistency issues with cached feature services * fix: Replace direct _registry access with registry property Fixes AttributeError where tests were directly accessing _registry before lazy initialization. With lazy loading, _registry starts as None and must be accessed through the registry property to trigger initialization. - Replace ._registry. with .registry. in test files - Add runtime error check in registry property for failed initialization - Ensures backward compatibility with existing code patterns Fixes CI test failures in search API tests. * fix: Prevent __repr__ from triggering lazy initialization The __repr__ method was accidentally calling self.registry (property) instead of self._registry (attribute), which would trigger lazy initialization whenever the FeatureStore object was printed or logged. This completely defeated the lazy loading optimization since any debugging, logging, or repr() call would cause full initialization (negating the 2.4s to 0.5s performance gain). - Change self.registry to self._registry in __repr__ method - Preserves lazy loading benefits for debugging/logging scenarios - Maintains correct status reporting without side effects --------- Co-authored-by: Claude Sonnet 4 <[email protected]>
1 parent d6c0b2d commit b37b7d0

File tree

5 files changed

+588
-533
lines changed

5 files changed

+588
-533
lines changed

0 commit comments

Comments
 (0)