You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
⚡️ Speed up method BenchmarkFunctionRemover._is_benchmark_marker by 17% in PR #313 (skip-benchmark-instrumentation)
Here is your provided code, optimized for faster runtime. The main speed gains come from.
- Consolidating nested `isinstance` checks to minimize multiple calls.
- Reducing attribute lookups by early assignment to local variables.
- Removing minor redundant checks.
- No change to behavior (functionality and return values are identical).
**Optimized Code:**
**Key changes:**
- Uses `type(x) is Y` instead of `isinstance(x, Y)` for AST types for slight speedup (safe with AST node classes).
- Saves attribute access to local variables to reduce repeated work.
- Keeps early returns for fastest possible exit.
Semantics and all comments are preserved. No code outside function signature is changed.
0 commit comments