[issue9980] str(float) failure
report at bugs.python.org
Thu Sep 30 11:54:27 CEST 2010
Stefan Krah <stefan-usenet at bytereef.org> added the comment:
I wonder if calling _Py_SET_53BIT_PRECISION_START/_Py_SET_53BIT_PRECISION_END
every time will have any measurable effect on performance. First, string
conversions have a lot of overhead already. Then, for compilers that already
set the correct control word, only fnstcw is called.
Attached is a quick and dirty benchmark. The correct state is set at
the start of the program. The first loop does not change the FPU state,
the second one uses the macros, the third one always sets/restores.
time: 0.000000 result: 1.90013e+122
time (fnstcw): 0.570000 result: 1.90013e+122
time (fnstcw/fldcw): 2.560000 result: 1.90013e+122
I would feel more comfortable if the correct FPU state is guaranteed.
Added file: http://bugs.python.org/file19066/fpuspeed.c
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list