File tree Expand file tree Collapse file tree
python/tools/recorded-call-graph-metrics/ql Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,14 +77,17 @@ class XMLCall extends XMLElement {
7777 bytecode .( XMLBytecodeAttribute ) .get_object_data ( ) )
7878 or
7979 matchBytecodeExpr ( expr .( Call ) .getFunc ( ) , bytecode .( XMLBytecodeCall ) .get_function_data ( ) )
80- // I experimented with allowing partial matches with
81- // ```
82- // or
83- // bytecode instanceof XMLBytecodeUnknown
84- // ```
85- // but that only gave 1% improvement for Identified calls with approx 4200 calls
86- // in total (only supporting BytecodeVariableName/BytecodeAttribute/BytecodeCall).
87- // Since it's a potential performance problem, I did not enable.
80+ // I considered allowing a partial match as well. That is, if the bytecode
81+ // expression information only tells us `<unknown>.foo()`, and we find an AST
82+ // expression that matches on `.foo()`, that is good enough.
83+ //
84+ // However, we cannot assume that all calls are recorded (such as `range(10)`),
85+ // and we cannot assume that for all recorded calls there exists a corresponding
86+ // AST call (such as for list-comprehensions).
87+ //
88+ // So allowing partial matches is not safe, since we might end up matching a
89+ // recorded call not in the AST together with an unrecorded call visible in the
90+ // AST.
8891 )
8992 }
9093}
You can’t perform that action at this time.
0 commit comments