perf: skip unused callers JSON decode in ProfileStats#2137
Merged
Conversation
5 tasks
KRRT7
force-pushed
the
cf-2132-skip-callers-json-decode
branch
from
May 7, 2026 09:29
57443fb to
bf47a12
Compare
KRRT7
force-pushed
the
perf/discovery-js-read
branch
from
May 7, 2026 16:52
5ab7ec3 to
084f79c
Compare
KRRT7
force-pushed
the
cf-2132-skip-callers-json-decode
branch
from
May 7, 2026 16:52
bf47a12 to
426c0ff
Compare
KRRT7
force-pushed
the
perf/discovery-js-read
branch
from
May 7, 2026 17:30
084f79c to
5356817
Compare
KRRT7
force-pushed
the
cf-2132-skip-callers-json-decode
branch
2 times, most recently
from
May 7, 2026 17:42
7c12c6c to
89cc54f
Compare
KRRT7
force-pushed
the
perf/discovery-js-read
branch
from
May 7, 2026 17:42
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.
KRRT7
force-pushed
the
perf/discovery-js-read
branch
from
May 7, 2026 22:47
2d9fd1e to
39d49b1
Compare
KRRT7
force-pushed
the
cf-2132-skip-callers-json-decode
branch
from
May 7, 2026 22:48
89cc54f to
448ff82
Compare
KRRT7
marked this pull request as ready for review
May 8, 2026 00:22
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