Skip to content

Memory reduction fixes#4176

Merged
springfall2008 merged 7 commits into
mainfrom
fix/ram
Jul 3, 2026
Merged

Memory reduction fixes#4176
springfall2008 merged 7 commits into
mainfrom
fix/ram

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 3, 2026 09:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets memory and allocation hot-spots in Predbat’s planning and history-handling paths by reducing deep-copies, compacting cached history storage, and avoiding repeated list materialisation/hashing during scenario exploration.

Changes:

  • Switch str2time to prefer datetime.fromisoformat() (with strptime fallback) and add targeted unit tests.
  • Introduce a compact EntityHistory columnar store for HA history caching, replacing prior deep-copy behavior and updating HAHistory tests accordingly.
  • Reduce planner allocation/log volume via incremental scenario hashing and gating detailed per-slot logs behind debug_enable.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
coverage/cases/predbat_debug_pre_saving1.yaml.expected.json Updates expected regression output after planning/history changes.
apps/predbat/utils.py Adds fromisoformat fast-path for time parsing and routes callers through str2time().
apps/predbat/unit_test.py Registers the new str2time test.
apps/predbat/tests/test_str2time.py Adds coverage for str2time parsing behavior across formats and modes.
apps/predbat/tests/test_single_debug.py Enables a faster, quieter regression-test path by toggling debug/kernel flags.
apps/predbat/tests/test_hahistory.py Updates tests for the new EntityHistory storage and adds dedicated store tests.
apps/predbat/plan.py Adds incremental scenario hashing to avoid copying/hashing full limit lists; gates detailed logs on debug_enable.
apps/predbat/inverter.py Allows minute_data to mutate history in specific paths to avoid deep-copy overhead.
apps/predbat/ha.py Implements EntityHistory and updates HAHistory caching/pruning/merge behavior to use the compact store.

Comment thread apps/predbat/ha.py Outdated
Comment thread apps/predbat/ha.py
@springfall2008 springfall2008 merged commit c167631 into main Jul 3, 2026
2 checks passed
@springfall2008 springfall2008 deleted the fix/ram branch July 3, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants