[Python-Dev] PEP 550 v4: Decimal examples and performance

Stefan Krah stefan at bytereef.org
Sun Aug 27 06:39:42 EDT 2017

On Sat, Aug 26, 2017 at 12:21:44PM -0400, Yury Selivanov wrote:
> On Sat, Aug 26, 2017 at 7:45 AM, Stefan Krah <stefan at bytereef.org> wrote:
> >> This generic caching approach is similar to what the current C
> >> implementation of ``decimal`` does to cache the the current decimal
> >> context, and has similar performance characteristics.
> >
> > I think it'll work, but can we agree on hard numbers like max 2% slowdown
> > for the non-threaded case and 4% for applications that only use threads?
> I'd be *very* surprised if wee see any noticeable slowdown at all. The
> way ContextVars will implement caching is very similar to the trick
> you use now.

I'd also be surprised, but what do we do if the PEP is accepted and for
some yet unknown reason the implementation turns out to be 12-15% slower?

The slowdown related to the module-state/heap-type PEPs wasn't immediately
obvious either; it would be nice to have actual figures before the PEP is

Stefan Krah

More information about the Python-Dev mailing list