]> Piment Noir Git Repositories - freqai-strategies.git/commit
fix(quickadapter): correct and harmonize builtin caching (#165)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 28 Jul 2026 14:44:40 +0000 (16:44 +0200)
committerGitHub <noreply@github.com>
Tue, 28 Jul 2026 14:44:40 +0000 (16:44 +0200)
commitba4ba4c6308bf2bc2be1dc8c0f759df412158db3
tree22304472bc14a02f6920d7b8b92c1cb85ed7e0a0
parent864ed7e69e62a5cd788a1a9d3868ccdef86916d0
fix(quickadapter): correct and harmonize builtin caching (#165)

Remove @lru_cache from the instance method
QuickAdapterRegressorV3.optuna_samplers_by_namespace: decorating a bound
method kept self in the process-lifetime cache, pinning regressor
instances (models, studies, dataframes) and leaking memory across
re-instantiations. The value is trivially recomputable.

Harmonize the rest of the builtin caching:
- Centralize lru_cache sizes into _CACHE_MAXSIZE_SMALL/_LARGE constants,
  replacing scattered 8/64/128 literals (right-sizes the oversized 64 on
  _label_aux_column_name).
- Drop ineffective @lru_cache on the float-keyed static helpers
  _t_statistic/_effective_df/_t_critical: continuous per-call float keys
  give a near-zero hit rate while _effective_df pays O(n) tuple hashing.
- Return a read-only ndarray from _calculate_coeffs so callers cannot
  corrupt the shared cached kernel.
- Document the _df_signature process_only_new_candles coupling.
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/QuickAdapterV3.py
quickadapter/user_data/strategies/Utils.py