Repository navigation
perf(semantic): exact, cheaper doc-section candidate scoring - #2582
Merged
Merged
Conversation
The doc-section candidate pass (#2574) made a Linux kernel index 2.8x slower: 207 s before #2574, 580 s after, on the same machine. Every candidate of every section got a dot product that merged the section's up to 1024 terms with the function's, and then every candidate was sorted for a top 10. - The section's vector is held densely per worker, indexed by term and stamped per section, so a candidate's dot product walks only the function's (or file's) own terms. The same products are added in the same ascending term order, so every score is the same float. - Only the candidates the results read are sorted: the top SEM_DOC_TOP_K (and the local ones down to CBM_SEM_DOC_MIN_SCORE), the top CBM_SEM_DOC_FILE_K files. cmp_doc_cand is a total order, so the sorted prefix is the full sort's prefix. Kernel (perf-bench/linux, M5 Pro, same plain build): 579.7 s -> 391.5 s, nodes and edges unchanged. Exactness, measured directly: a build that also ran the old merge and the old full sort found 0 score, 0 shared-term and 0 order differences over 5,003 django sections. Candidate generation itself (a section's key terms, df <= funcs/20) is unchanged here: narrowing it would change the stored rows. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The doc-section candidate pass from #2574 made indexing the Linux kernel about 2.8x slower: 207 s before #2574 and 580 s after it, same machine, same build. A teammate's call trees put about 85 % of that time in the per-candidate dot products and about 14 % in sorting.
What changes (output unchanged)
cmp_doc_candis a total order, so sorting this subset gives exactly the same first entries as the full sort did.Measured
perf-bench/linux, M5 Pro, same plain build, quiet machine): 579.7 s → 391.5 s. Nodes (8,540,291) and edges (16,765,478) are identical.semantic,pipeline,pipeline_semantic_manifest_repro,store_arch,mcpall pass. cppcheck 2.20, clang-format and the memory-core lint are clean.Not in this PR
doc_link_candidates: the kernel A/B also showed these, but they come from main itself (two runs of the same build differ). The cause is in the reST section text (rst_body); a separate fix follows.