You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
go/doc: repeated declaration indexing makes Examples quadratic #82675
Each playable example rebuilds the same top-level declaration and method indexes. Index construction takes O(E*D) work for E examples and D declarations, becoming quadratic when both grow together.
At 1,000 examples the measured operation took 68.412 ms and allocated 104.69 MiB; at 2,000 it took 319.380 ms and allocated 417.710 MiB.
What did you expect to see?
Examples from the same file should share its read-only declaration indexes.
CartoGopher tooling for source navigation; reproduction, implementation and testing with Codex.
5. #78801 right?
I think it's different. #78801 was already fixed and seems to be more so an infinite loop (judging from how it never finishes and eventually OOMs).
All good, I won’t be offended if it’s not as useful as I thought. I did try it on the Google Cloud SDK: example extraction went from 116 ms to 68 ms, and allocated memory from 68.5 MiB to 34.5 MiB. Overall it was small, but I still figured it was something :)
Activity
seankhliao commentedon Oct 28, 2026
given the low number of examples in a typical package I can hardly see this as a problem
gopherbot commentedon Oct 28, 2026
Change https://go.dev/cl/855661 mentions this issue:
go/doc: reuse declaration indexes across examplesthatnealpatel commentedon Oct 28, 2026
@nicholashusin Is this the elusive
go docbug we saw a few months ago?!nicholashusin commentedon Oct 28, 2026
#78801 right?
I think it's different. #78801 was already fixed and seems to be more so an infinite loop (judging from how it never finishes and eventually OOMs).
JakeNesler commentedon Oct 28, 2026
I just tried it and they are indeed different 👍
thatnealpatel commentedon Oct 28, 2026
I agree with @seankhliao
JakeNesler commentedon Oct 28, 2026
All good, I won’t be offended if it’s not as useful as I thought. I did try it on the Google Cloud SDK: example extraction went from 116 ms to 68 ms, and allocated memory from 68.5 MiB to 34.5 MiB. Overall it was small, but I still figured it was something :)
JunyangShao commentedon Oct 29, 2026
@griesemer