Skip to content

fix(perf): preallocate bounded slice results - #35

Merged
enowdev merged 3 commits into
enowdev:mainfrom
elliottophellia:CEG-016
Aug 17, 2026
Merged

fix(perf): preallocate bounded slice results#35
enowdev merged 3 commits into
enowdev:mainfrom
elliottophellia:CEG-016

Conversation

@elliottophellia

Copy link
Copy Markdown
Collaborator

Summary

Preallocate slices where the output size is already bounded, reducing growth
reallocations in frequently used result-building paths.

Changes include:

  • Preallocate bounded SQL result slices from their normalized query limits:
    • memory results
    • session results
    • message search results
    • cron runs
  • Reserve bounded capacity for panel answers and transcript normalization.
  • Preallocate engagement-session response rows from the bounded session list.
  • Preserve existing result ordering, JSON shape, empty-slice behavior, and
    tool-result binding semantics.

Validation

  • GOTOOLCHAIN=go1.26.3 go test ./...
  • go vet ./...
  • make check
  • Focused tests for internal/store, internal/agent, and internal/server
  • Frontend tests: 12 passed, 0 failed

Use normalized SQL limits as result-slice capacities for bounded memory, session, search, and cron queries. Preserve the existing non-nil empty-slice behavior while avoiding growth reallocations during row scans.
Reserve the panel's bounded usable-answer list and the transcript repair index and turn list from the message count. Keep the existing two-pass tool-result binding and output ordering unchanged.
Use the bounded session-list length as the response capacity while preserving the existing findings/intel filter and JSON shape.
@enowdev
enowdev merged commit 19f5622 into enowdev:main Aug 17, 2026
2 checks passed
@elliottophellia
elliottophellia deleted the CEG-016 branch August 17, 2026 12:42
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