
On Fri, 15 May 2020 06:06:00 -0000 "Brandt Bucher" <brandtbucher@gmail.com> wrote:
Ethan Furman wrote:
Can you do those with _pydecimal? If performance were an issue anywhere I would expect to see it with number crunching.
No difference, probably because those methods look like they spend most of their time doing string manipulation: [ snip micro-benchmarks ]
And in any case, people who are concerned about performance should use the C decimal accelerator, which is the default. Here is your micro-benchmark with _pydecimal (which is the pure Python fallback): $ python3.8 -m pyperf timeit -s "$PYPERFSETUP" "$PYPERFRUN" ..................... Mean +- std dev: 35.4 us +- 1.1 us Here is the same micro-benchmark with decimal (which loads the C accelerator by default): $ python3.8 -m pyperf timeit -s "$PYPERFSETUP" "$PYPERFRUN" ..................... Mean +- std dev: 471 ns +- 12 ns Even if you were losing performance on those 35.4us it wouldn't make sense to complain about it. Regards Antoine.