Skip to content

Conversation

@abtreece
Copy link
Owner

Summary

  • Pre-allocate template slice capacity in getTemplateResources() using the count from RecursiveFilesLookup
  • Eliminates repeated slice growth allocations during template loading

Test plan

  • All unit tests pass (go test ./...)
  • Build succeeds (go build ./...)

Fixes #441

Move slice allocation after RecursiveFilesLookup and use len(paths)
to pre-allocate capacity, eliminating repeated slice growth allocations.

Fixes #441
Copilot AI review requested due to automatic review settings January 22, 2026 02:56
Copy link

Copilot AI left a comment

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 optimizes memory allocation in the template loading process by pre-allocating the slice capacity based on the number of discovered template files, eliminating the need for multiple slice growth operations during appending.

Changes:

  • Moved slice initialization to after template file discovery to leverage the known count for capacity pre-allocation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.64%. Comparing base (cf11fa9) to head (a89de73).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #454      +/-   ##
==========================================
- Coverage   59.69%   59.64%   -0.06%     
==========================================
  Files          48       48              
  Lines        5223     5223              
==========================================
- Hits         3118     3115       -3     
- Misses       1901     1903       +2     
- Partials      204      205       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@abtreece abtreece merged commit 308bbfc into main Jan 22, 2026
11 checks passed
@abtreece abtreece deleted the fix/preallocate-template-slice branch January 22, 2026 02:59
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.

Pre-allocate template slice in getTemplateResources

1 participant