Source
CodeRabbit findings #3 and #5 from PR #2.
What
Two computed properties recompute on every access:
flattenedHeadings in ParselyViewModel recursively flattens the heading tree
anchorMap in MarkdownDetailView iterates all blocks to build a slug-to-lineIndex lookup
Why deferred
Markdown files in practice have tens of headings, not thousands. The flattening and map-building are O(n) where n is heading count — negligible for real-world files. Premature optimization at this stage adds complexity without measurable benefit.
When to revisit
If Parsely ever supports very large generated markdown files (10K+ lines with hundreds of headings) and profiling shows these as hot paths.
Files
app/Parsely/Parsely/ViewModels/ParselyViewModel.swift (lines 90-108)
app/Parsely/Parsely/Views/Screens/MarkdownDetailView.swift (lines 7-16)
Source
CodeRabbit findings #3 and #5 from PR #2.
What
Two computed properties recompute on every access:
flattenedHeadingsinParselyViewModelrecursively flattens the heading treeanchorMapinMarkdownDetailViewiterates all blocks to build a slug-to-lineIndex lookupWhy deferred
Markdown files in practice have tens of headings, not thousands. The flattening and map-building are O(n) where n is heading count — negligible for real-world files. Premature optimization at this stage adds complexity without measurable benefit.
When to revisit
If Parsely ever supports very large generated markdown files (10K+ lines with hundreds of headings) and profiling shows these as hot paths.
Files
app/Parsely/Parsely/ViewModels/ParselyViewModel.swift(lines 90-108)app/Parsely/Parsely/Views/Screens/MarkdownDetailView.swift(lines 7-16)