Skip to content

perf: speed up Selection.Text by outlining recursion#561

Open
jvoisin wants to merge 1 commit into
PuerkitoBio:masterfrom
jvoisin:noclosure
Open

perf: speed up Selection.Text by outlining recursion#561
jvoisin wants to merge 1 commit into
PuerkitoBio:masterfrom
jvoisin:noclosure

Conversation

@jvoisin
Copy link
Copy Markdown
Contributor

@jvoisin jvoisin commented May 27, 2026

Replace the recursive closure in Selection.Text with a helper method call. This keeps behavior unchanged while reducing runtime overhead in the hot path.

Benchmark (BenchmarkText, benchstat, n=12):

  • sec/op: 2.133us -> 1.692us (-20.70%, p=0.000)
  • B/op: 504 -> 504 (no change)
  • allocs/op: 6 -> 6 (no change)

Replace the recursive closure in Selection.Text with a helper method call.
This keeps behavior unchanged while reducing runtime overhead in the hot path.

Benchmark (BenchmarkText, benchstat, n=12):
- sec/op: 2.133us -> 1.692us (-20.70%, p=0.000)
- B/op: 504 -> 504 (no change)
- allocs/op: 6 -> 6 (no change)
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