summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-11-02 13:29:05 (GMT)
committerGitHub <noreply@github.com>2023-11-02 13:29:05 (GMT)
commit4fe22c73770fe86b01ef7a4f1f38e7e925c0e090 (patch)
tree0f9e95952e3a2a9722b4b379e3c5a7d9620014d9 /Misc
parent6a0d7b43df12ab4426badd09d2796e66838129ac (diff)
downloadcpython-4fe22c73770fe86b01ef7a4f1f38e7e925c0e090.zip
cpython-4fe22c73770fe86b01ef7a4f1f38e7e925c0e090.tar.gz
cpython-4fe22c73770fe86b01ef7a4f1f38e7e925c0e090.tar.bz2
gh-111482: Use Argument Clinic for clock_gettime() (#111641)
Use Argument Clinic for time.clock_gettime() and time.clock_gettime_ns() functions. Benchmark on time.clock_gettime_ns(): import time import pyperf runner = pyperf.Runner() runner.timeit( 'clock_gettime_ns(CLOCK_MONOTONIC_COARSE)', setup='import time; clock_gettime_ns=time.clock_gettime_ns; CLOCK_MONOTONIC_COARSE=6', stmt='clock_gettime_ns(CLOCK_MONOTONIC_COARSE)') Result on Linux with CPU isolation: Mean +- std dev: [ref] 134 ns +- 1 ns -> [change] 55.7 ns +- 1.4 ns: 2.41x faster
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/Library/2023-11-02-12-15-46.gh-issue-111482.FWqZIU.rst3
1 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2023-11-02-12-15-46.gh-issue-111482.FWqZIU.rst b/Misc/NEWS.d/next/Library/2023-11-02-12-15-46.gh-issue-111482.FWqZIU.rst
new file mode 100644
index 0000000..d73e45c
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-11-02-12-15-46.gh-issue-111482.FWqZIU.rst
@@ -0,0 +1,3 @@
+:mod:`time`: Make :func:`time.clock_gettime()` and
+:func:`time.clock_gettime_ns()` functions up to 2x faster by faster calling
+convention. Patch by Victor Stinner.