Skip to content

fix(models): reserve storm reports only for features that become reports - #28

Merged
Reddimus merged 1 commit into
mainfrom
fix/storm-report-reserve
Sep 25, 2026
Merged

Reddimus merged 1 commit into
mainfrom
fix/storm-report-reserve

Conversation

@Reddimus

Copy link
Copy Markdown
Owner

Summary

#16 made parse_storm_reports reserve its list from the number of features, on the grounds that every IEM feature becomes a report. It skips elements without properties, though, so a body padded with anything else reserved memory it never used, and the empty result kept it: about 2.6 MB for 10,000 zeros, and about 500 MiB for a 4 MB body of two million. It now counts the elements that will become reports and reserves exactly that. The spc-cpp release review found this.

Closes #27

The bug never shipped (v0.4.1 grows the list as it goes), so there's no CHANGELOG entry; #16's entry still describes the behavior.

Benchmarks

BM_Parse/storm_reports on the 624-report IEM fixture, main (153f76e) against this branch, macOS with Apple Clang 21. The counting pass costs 0.4% more instructions (20,442,098 → 20,528,443). Allocations, bytes allocated, and memory held by the result are unchanged, so #16's savings stand.

Testing

  • New Models.StormReportsReserveOnlyForReports parses 10,000 zeros and expects the empty result to keep no capacity. On main it keeps 10,000.

  • Models.StormReportsParseIemLsr still checks that a real day's list is sized with one reservation.

  • macOS: make test passes 130/130 and make lint is clean.

  • make test and make lint pass

  • CHANGELOG.md: no entry, since the bug is unreleased

  • No public API changes

Copilot AI lite review requested due to automatic review settings September 25, 2026 21:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Reddimus
Reddimus merged commit cf095c4 into main Sep 25, 2026
10 checks passed
@Reddimus
Reddimus deleted the fix/storm-report-reserve branch September 25, 2026 21:50
Reddimus added a commit that referenced this pull request Sep 25, 2026
Sets the version to 0.4.2 in `include/spc/version.hpp`, dates the
changelog section, and points the README's `GIT_TAG` at v0.4.2, which
`make test-consumers` checks. The `find_package(spc 0.4 REQUIRED)` line
stays, because 0.4.x is compatible.

v0.4.2 contains the performance and correctness work measured in each
PR: #16 and #28 (the storm report list is sized once, and only for real
reports), #19 (numeric strings parse the same way on every platform),
#21 (the typed ArcGIS queries parse each page once, about half the CPU
and allocations), #24 (the `parse_*` functions stay inside their
`string_view`), #25 (error docs), plus the CI and test-tooling changes
in #22, #26, and #29. No public API changes.

After merge, tagging `v0.4.2` runs the release workflow. It checks the
tag against `version.hpp`, runs the tests and consumer checks, and
publishes the changelog section as the release notes.
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.

parse_storm_reports reserves room for features it skips

2 participants