perf: skip unused callers JSON decode in ProfileStats#2137
Merged
KRRT7 merged 1 commit intoperf/discovery-ast-cachefrom May 8, 2026
Merged
perf: skip unused callers JSON decode in ProfileStats#2137KRRT7 merged 1 commit intoperf/discovery-ast-cachefrom
KRRT7 merged 1 commit intoperf/discovery-ast-cachefrom
Conversation
5 tasks
57443fb to
bf47a12
Compare
5ab7ec3 to
084f79c
Compare
bf47a12 to
426c0ff
Compare
084f79c to
5356817
Compare
7c12c6c to
89cc54f
Compare
5356817 to
2d9fd1e
Compare
The callers BLOB column was fetched and JSON-decoded for every row during FunctionRanker initialization, but the resulting data was never accessed — FunctionRanker.load_function_stats() discards it as `_callers`. This eliminates O(n) JSON parsing at ranking startup. Also fixes all pre-existing mypy errors in this file by declaring pstats.Stats attributes that the type stubs don't expose.
2d9fd1e to
39d49b1
Compare
89cc54f to
448ff82
Compare
Base automatically changed from
perf/discovery-js-read
to
perf/discovery-ast-cache
May 8, 2026 00:28
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.
Summary
callersBLOB column inProfileStats.create_stats()— it was fetched and JSON-decoded for every row but never used byFunctionRankerFunctionRanker.__init__)profile_stats.pyby declaringpstats.Statsdynamic attributesContext
Part of #2132 (E2E performance, item 9). The
callerscolumn is written by the tracer but never read back —FunctionRanker.load_function_stats()unpacks it as_callersand discards it, andcall_graph.pyuses its own query that already excludes the column.Stack
mainperf/discovery-prefilterperf/discovery-ast-cacheperf/discovery-js-readTest plan
tests/test_function_ranker.pytests pass