◐ Shell
clean mode source ↗

On path with a known exact float, extract the double with a fast macro. by rhettinger · Pull Request #21072 · python/cpython

@rhettinger

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Jun 23, 2020
…o. (pythonGH-21072)

(cherry picked from commit 930f451)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>

fasih pushed a commit to fasih/cpython that referenced this pull request

Jun 29, 2020

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Sep 4, 2020
…o. (pythonGH-21072)

(cherry picked from commit 930f451)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>

miss-islington added a commit that referenced this pull request

Sep 4, 2020
…o. (GH-21072)

(cherry picked from commit 930f451)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>

hauntsaninja added a commit to hauntsaninja/cpython that referenced this pull request

Sep 2, 2023
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
```

hauntsaninja added a commit to hauntsaninja/cpython that referenced this pull request

Sep 3, 2023
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
```

hauntsaninja added a commit that referenced this pull request

Oct 6, 2023
This matches a similar optimisation done for math.floor in
#21072

Glyphack pushed a commit to Glyphack/cpython that referenced this pull request

Sep 2, 2024
)

This matches a similar optimisation done for math.floor in
python#21072