Skip to content

reduce "module_imports_on_top_of_file" execution time by ~20% #1292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abebus
Copy link

@abebus abebus commented Jul 17, 2025

@abebus abebus mentioned this pull request Jul 17, 2025
@abebus abebus changed the title this reduces execution time from ~1500 ns to ~1250 ns this reduces function execution time by ~20% Jul 17, 2025
@abebus abebus changed the title this reduces function execution time by ~20% reduce "module_imports_on_top_of_file" execution time by ~20% Jul 17, 2025
@abebus abebus force-pushed the speedups/module_imports_on_top_of_file branch from 38c0977 to 41e842c Compare July 17, 2025 11:43
@sigmavirus24
Copy link
Member

I wonder if the new profiler in 3.15 would be worth testing here.

I also really wish it were easy to write "benchmark tests" in Python like it is in Go and Rust. I'd love to be continuously verifying nothing regresses on some of these changes and potentially see changes between python versions etc

@abebus
Copy link
Author

abebus commented Jul 18, 2025

New profiler in Python 3.15 does look promising, but I haven't tried it yet.

On the benchmarking side — totally agree. That said, tools like pytest-benchmark and codespeed might help get closer to what you're describing, especially if we ever wanted to track performance across versions or PRs. Could be worth exploring if there’s interest in building out some kind of minimal benchmark harness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants