perf: More efficient calling frame detection#1884
Merged
Merged
Conversation
Contributor
|
| Branch | mr/perf/calling-frame-detection |
| Testbed | Linux |
Click to view all benchmark results
| Benchmark | hugr_bytes | Benchmark Result bytes x 1e3 (Result Δ%) | Upper Boundary bytes x 1e3 (Limit %) | hugr_nodes | Benchmark Result nodes (Result Δ%) | Upper Boundary nodes (Limit %) |
|---|---|---|---|---|---|---|
| tests/benchmarks/test_big_array.py::test_big_array_compile | 📈 view plot 🚷 view threshold | 154.02 x 1e3(0.00%)Baseline: 154.02 x 1e3 | 155.56 x 1e3 (99.01%) | 📈 view plot 🚷 view threshold | 6,630.00(0.00%)Baseline: 6,630.00 | 6,696.30 (99.01%) |
| tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_compile | 📈 view plot 🚷 view threshold | 27.71 x 1e3(0.00%)Baseline: 27.71 x 1e3 | 27.99 x 1e3 (99.01%) | 📈 view plot 🚷 view threshold | 1,051.00(0.00%)Baseline: 1,051.00 | 1,061.51 (99.01%) |
| tests/benchmarks/test_queue_push_pop.py::test_queue_push_benchmark_compile | 📈 view plot 🚷 view threshold | 10.09 x 1e3(0.00%)Baseline: 10.09 x 1e3 | 10.19 x 1e3 (99.01%) | 📈 view plot 🚷 view threshold | 301.00(0.00%)Baseline: 301.00 | 304.01 (99.01%) |
| tests/benchmarks/test_queue_push_pop.py::test_queue_push_pop_benchmark_compile | 📈 view plot 🚷 view threshold | 13.69 x 1e3(-0.01%)Baseline: 13.70 x 1e3 | 13.83 x 1e3 (99.00%) | 📈 view plot 🚷 view threshold | 420.00(0.00%)Baseline: 420.00 | 424.20 (99.01%) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1884 +/- ##
=======================================
Coverage 92.84% 92.84%
=======================================
Files 146 146
Lines 13822 13822
=======================================
Hits 12833 12833
Misses 989 989 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will improve performance by 17.56%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | test_circuit_comptime_compile |
1.7 s | 1.5 s | +17.56% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing mr/perf/calling-frame-detection (2c2ecb3) with main (e2c7014)
nicolaassolini-qntm
approved these changes
Jun 18, 2026
nicolaassolini-qntm
left a comment
Contributor
There was a problem hiding this comment.
17% faster, nice ![]()
This was referenced Jun 18, 2026
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.
Using
inspect.getmoduleis overkill when all you are trying to retrieve is the name of the module (you can access that through the file-global__name__as well). At the same time,inspect.getmoduleaccesses the file cache of the Python interpreter, potentially doing a lot of IO. During tracing workloads, calling frame detection is run for most expressions for purposes of nice error messages, and thus theinspect.getmoduleis called in a rather hot loop. Any improvements here are vital for tracing performance.