This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Faster float.fromhex()
Type: performance Stage: resolved
Components: Interpreter Core Versions: Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: mark.dickinson, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2016-05-12 06:48 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
float_fromhex.patch serhiy.storchaka, 2016-05-12 06:48 review
Messages (6)
msg265366 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-12 06:48
Proposed patch makes float.fromhex() faster for exact float.

$ ./python -m timeit -s "h = float.hex(1.23)" -- "float.fromhex(h)"

Unpatched: 1000000 loops, best of 3: 0.886 usec per loop
Patched:   1000000 loops, best of 3: 0.519 usec per loop
msg265367 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2016-05-12 07:00
LGTM
msg265369 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-05-12 07:21
New changeset 3b19660611a4 by Serhiy Storchaka in branch 'default':
Issue #27005: Optimized the float.fromhex() class method for exact float.
https://hg.python.org/cpython/rev/3b19660611a4
msg265370 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-12 07:22
Thank you Mark.
msg265371 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-05-12 07:32
New changeset 1bae2a6bb37c by Serhiy Storchaka in branch 'default':
Issue #27005: Fixed the call of PyObject_CallFunctionObjArgs().
https://hg.python.org/cpython/rev/1bae2a6bb37c
msg265374 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-12 07:53
A mistake in using PyObject_CallFunctionObjArgs() caused a crash in using fromhex() for subclasses. New tests added in issue23640 covers this case.
History
Date User Action Args
2022-04-11 14:58:30adminsetgithub: 71192
2016-05-12 07:53:10serhiy.storchakasetmessages: + msg265374
2016-05-12 07:32:54python-devsetmessages: + msg265371
2016-05-12 07:22:17serhiy.storchakasetstatus: open -> closed
messages: + msg265370

assignee: serhiy.storchaka
resolution: fixed
stage: patch review -> resolved
2016-05-12 07:21:41python-devsetnosy: + python-dev
messages: + msg265369
2016-05-12 07:00:54mark.dickinsonsetmessages: + msg265367
2016-05-12 06:48:22serhiy.storchakacreate