| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| if (PyErr_Occurred()) | ||
| return NULL; | ||
| x = PyFloat_AsDouble(number); | ||
| if (x == -1.0 && PyErr_Occurred()) |
There was a problem hiding this comment.
This will be partially covered by tests.
Sorry, something went wrong.
There was a problem hiding this comment.
After merging #102523 this should be fixed.
Sorry, something went wrong.
| if (PyFloat_CheckExact(number)) { | ||
| x = PyFloat_AS_DOUBLE(number); | ||
| } | ||
| else |
There was a problem hiding this comment.
Maybe we should follow to the PEP 7 here?
Sorry, something went wrong.
This matches a similar optimisation done for math.floor in python#21072 Before: ``` λ ./python.exe -m timeit -r 11 -s 'from math import ceil' -s 'x=3.14' 'ceil(x)' 20000000 loops, best of 11: 13.3 nsec per loop λ ./python.exe -m timeit -r 11 -s 'from math import ceil' -s 'x=0.0' 'ceil(x)' 20000000 loops, best of 11: 13.3 nsec per loop λ ./python.exe -m timeit -r 11 -s 'from math import ceil' -s 'x=-3.14E32' 'ceil(x)' 10000000 loops, best of 11: 35.3 nsec per loop λ ./python.exe -m timeit -r 11 -s 'from math import ceil' -s 'x=-323452345.14' 'ceil(x)' 10000000 loops, best of 11: 21.8 nsec per loop ``` After: ``` λ ./python.exe -m timeit -r 11 -s 'from math import ceil' -s 'x=3.14' 'ceil(x)' 20000000 loops, best of 11: 11.8 nsec per loop λ ./python.exe -m timeit -r 11 -s 'from math import ceil' -s 'x=0.0' 'ceil(x)' 20000000 loops, best of 11: 11.7 nsec per loop λ ./python.exe -m timeit -r 11 -s 'from math import ceil' -s 'x=-3.14E32' 'ceil(x)' 10000000 loops, best of 11: 32.7 nsec per loop λ ./python.exe -m timeit -r 11 -s 'from math import ceil' -s 'x=-323452345.14' 'ceil(x)' 10000000 loops, best of 11: 20.1 nsec per loop ```
|
Thanks for the review! I'd avoided PEP 7 for consistency with floor, but I just changed both |
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot AMD64 Fedora Stable LTO + PGO 3.x has failed when building commit f013b47. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/all/#builders/29/builds/4915 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-x86_64.lto-pgo/build/Lib/test/test_concurrent_futures/test_shutdown.py", line 50, in test_interpreter_shutdown
self.assertEqual(out.strip(), b"apple")
AssertionError: b'' != b'apple'
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot AMD64 RHEL8 FIPS Only Blake2 Builtin Hash 3.x has failed when building commit f013b47. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/all/#builders/469/builds/6217 Failed tests:
Summary of the results of the build (if available): == Click to see traceback logsremote: Enumerating objects: 18, done.
remote: Counting objects: 5% (1/18)
remote: Counting objects: 11% (2/18)
remote: Counting objects: 16% (3/18)
remote: Counting objects: 22% (4/18)
remote: Counting objects: 27% (5/18)
remote: Counting objects: 33% (6/18)
remote: Counting objects: 38% (7/18)
remote: Counting objects: 44% (8/18)
remote: Counting objects: 50% (9/18)
remote: Counting objects: 55% (10/18)
remote: Counting objects: 61% (11/18)
remote: Counting objects: 66% (12/18)
remote: Counting objects: 72% (13/18)
remote: Counting objects: 77% (14/18)
remote: Counting objects: 83% (15/18)
remote: Counting objects: 88% (16/18)
remote: Counting objects: 94% (17/18)
remote: Counting objects: 100% (18/18)
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 5% (1/18)
remote: Compressing objects: 11% (2/18)
remote: Compressing objects: 16% (3/18)
remote: Compressing objects: 22% (4/18)
remote: Compressing objects: 27% (5/18)
remote: Compressing objects: 33% (6/18)
remote: Compressing objects: 38% (7/18)
remote: Compressing objects: 44% (8/18)
remote: Compressing objects: 50% (9/18)
remote: Compressing objects: 55% (10/18)
remote: Compressing objects: 61% (11/18)
remote: Compressing objects: 66% (12/18)
remote: Compressing objects: 72% (13/18)
remote: Compressing objects: 77% (14/18)
remote: Compressing objects: 83% (15/18)
remote: Compressing objects: 88% (16/18)
remote: Compressing objects: 94% (17/18)
remote: Compressing objects: 100% (18/18)
remote: Compressing objects: 100% (18/18), done.
remote: Total 18 (delta 4), reused 6 (delta 0), pack-reused 0
From https://github.com/python/cpython
* branch main -> FETCH_HEAD
Note: switching to 'f013b475047b2e9d377feda9f2e16e5cdef824d7'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at f013b47504 gh-110489: Optimise math.ceil for known exact float (#108801)
Switched to and reset branch 'main'
make: *** [Makefile:2018: buildbottest] Error 5 |
Sorry, something went wrong.
) This matches a similar optimisation done for math.floor in python#21072
| Back | FazBrowse Home | New Git URL |
This matches a similar optimisation done by rhettinger for math.floor in #21072
Before:
After: