Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Counts Python code insight work in tests via PyCodeInsightCounters, measuring type evaluation, control flow and completion counters.
18% 100%+82 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 4 of 22 without it.
Which counter tracks individual execution steps inside PyTypeChecker.match?
Names MATCH_STEPS as the counter measuring type matching steps.
This test ran on v4. v8 is the current version and hasn’t been tested on gemini-3.6-flash yet.
3 of 3 safety checks passed
PyCodeInsightCounters (python-psi-impl, package com.jetbrains.python.codeInsight) counts the work of the Python
code insight. PyPerfProbe (community/python/testFramework, package com.intellij.python.community.testFramework.performance)
measures a scenario with these counters, the wall time, the allocations and the AST loads.
| Counter | Counts | Hook |
|---|---|---|
GET_TYPE_CALLS | each getType call | TypeEvalContextImpl.getType |
GET_TYPE_CACHE_HITS | the calls that the context cache answers | TypeEvalContextImpl.getType |
GET_TYPE_EVALUATIONS | the calls that evaluate a type | TypeEvalContextImpl.getType |
CONTEXTS_CONSTRUCTED | each type context, also the library and assumption contexts | TypeEvalContextImpl constructor |
CONTEXT_LOOKUP_MISSES | the context lookups that store a new context | TypeEvalContextCacheImpl |
ASSUME_TYPE_CALLS | the narrowing assumptions that create a context | TypeEvalContextImpl.assumeType |
MATCH_STEPS | the steps of the type match | PyTypeChecker.match |
TYPE_TRAVERSAL_VISITS | the types that a recursive type walk visits | PyRecursiveTypeVisitor.visitPyType |
OVERLOAD_CANDIDATES_CHECKED | the overload candidates that the argument types check | PyCallExpressionHelper.matchesByArgumentTypes |
CFG_BUILDS, CFG_INSTRUCTIONS | the control flow builds and their instructions | PyControlFlowBuilder.buildControlFlow |
SCOPE_GLOBALS_VISITS | the scopes that the index of nested global names visits | ScopeImpl.collectNestedGlobals |
COMPLETION_LOOKUP_ITEMS | the lookup items of the Python completion | CompletionVariantsProcessor.setupItem |
PATH_CACHE_CLEARS | the clears of a non-empty resolve path cache | PythonPathCache.clearCache |
DJANGO_TAG_LIBRARY_SCANS | the scans of a Django tag library for its registered tags and filters | DjangoTagLibrary.getRegistrations |
DJANGO_TEMPLATE_LOAD_SCANS | the scans of a Django template for the tags and filters that it loads | DjangoTagLibrary.getLoadedTags |
A cache hit and an evaluation do not add up to the calls. The rest are library delegations and the requests that the recursion guard stops.
The counting is off by default. For the work of the calling thread only:
val counts = PyCodeInsightCounters.countOnCurrentThread { context.getType(expression) }
assertEquals(1L, counts.getValue(Counter.GET_TYPE_EVALUATIONS))
Next to this one in the catalogue, plus more from the same author.