Skip to content

refactor: construct BacklinksMap once and pass by reference#397

Merged
boykush merged 1 commit intomainfrom
refactor/backlinks-map-single-construction
Feb 14, 2026
Merged

refactor: construct BacklinksMap once and pass by reference#397
boykush merged 1 commit intomainfrom
refactor/backlinks-map-single-construction

Conversation

@boykush
Copy link
Owner

@boykush boykush commented Feb 14, 2026

Summary

  • Construct BacklinksMap once in BuildUsecase::execute() and pass &BacklinksMap to all renders (IndexRender, ScrapRender, TagRender, TagsIndexRender)
  • Remove redundant BacklinksMap::new() calls from each render's run() method
  • Remove scraps: Vec<Scrap> field from ScrapRender and TagRender structs, simplifying their constructors

Test plan

  • mise run cargo:quality passes (build, test, fmt, clippy)
  • mise run perf:test passes (build time: 2.373s < 4s threshold)

🤖 Generated with Claude Code

…nders

BacklinksMap was being constructed independently in each render (IndexRender,
ScrapRender, TagRender, TagsIndexRender), causing redundant O(N) work per
render. Now constructed once in BuildUsecase::execute() and passed as &BacklinksMap,
also removing the scraps field from ScrapRender and TagRender structs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

Performance Test Results 🚀

Build Time: 0.987 seconds
Status: ✅ PASS

Executed with: scraps build -v
Repository: boykush/wiki
Runner: Ubuntu latest

@boykush boykush merged commit b8e2b17 into main Feb 14, 2026
3 checks passed
@boykush boykush deleted the refactor/backlinks-map-single-construction branch February 14, 2026 07:20
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.

1 participant