-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
gh-80642: timeit - make target time of autorange configurable #140283
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
base: main
Are you sure you want to change the base?
Conversation
- have `timeit` and `repeat` methods (and functions) fall back on `autorange` if the number is set to 0 or None.
…cpython into fix-issue-36461
Misc/NEWS.d/next/Library/2019-04-25-21-11-37.bpo-36461.TO5YyP.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Hugo van Kemenade <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
|
Previously timeit returned a single value. Now it can return a pair if number is 0. This should be better documented because it coule be breaking existing code (I do not know if 0 was a legit value beforehand). I do not think we should expose the handling of number=0 to the timeit method itself. Or if this is the case we should first determine the number by autorange and then pass it to timeit() for the "real" test. I cannot comment on the PR because the mobile app is not working well so I am only commenting here, but please consider this as me requesting changes. |
Co-authored-by: Stan Ulbrych <[email protected]>
When I resurrected this PR, I thought this was a plausibly-useful convenience feature. However, I'm not so sure anymore:
I'm inclined to undo the change. An alternative option would be to provide a new top level convenience method |
|
Looking back at @stevendaprano's original idea, the proposal was that the autorange fallback would be used when |
This is an updated version of PR #12954 with latest main merged in. I also fixed a few issues in the original (it's now consistently called
target_time, there was a float conversion missing, etc.).To quote the original PR:
📚 Documentation preview 📚: https://cpython-previews--140283.org.readthedocs.build/