Skip to content

gh-116946: remove unnecessary gc from _decimal types - #156034

Closed
skirpichev wants to merge 2 commits into
python:mainfrom
skirpichev:decimal-nogc/116946
Closed

skirpichev wants to merge 2 commits into
python:mainfrom
skirpichev:decimal-nogc/116946

Conversation

@skirpichev

@skirpichev skirpichev commented Aug 19, 2026 •

Copy link
Copy Markdown
Member

On my laptop (gcc 14.2, default configure flags) for pyperformance benchmarks (decimal_* should be enabled first, see python/pyperformance#473):

decimal_factorial: Mean +- std dev: [ref] 1.05 sec +- 0.02 sec -> [patch] 918 ms +- 6 ms: 1.14x faster
decimal_pi: Mean +- std dev: [ref] 1.99 sec +- 0.02 sec -> [patch] 1.76 sec +- 0.02 sec: 1.13x faster
telco: Mean +- std dev: [ref] 78.7 ms +- 0.5 ms -> [patch] 73.5 ms +- 0.4 ms: 1.07x faster

Geometric mean: 1.11x faster

Micro-benchmark (same as in #158207):

Decimal(0): Mean +- std dev: [ref] 545 ns +- 19 ns -> [patch] 451 ns +- 30 ns: 1.21x faster
Decimal(123): Mean +- std dev: [ref] 550 ns +- 32 ns -> [patch] 450 ns +- 9 ns: 1.22x faster
Decimal('123'): Mean +- std dev: [ref] 721 ns +- 19 ns -> [patch] 624 ns +- 31 ns: 1.16x faster

Geometric mean: 1.19x faster
@skirpichev

Copy link
Copy Markdown
Member Author

This partially fix speed regression, noticed in #144650.

@skirpichev

Copy link
Copy Markdown
Member Author

@serhiy-storchaka, does it make sense for you?

@skirpichev

Copy link
Copy Markdown
Member Author
@vstinner

vstinner commented Nov 2, 2026

Copy link
Copy Markdown
Member

I was away for 2 weeks. The benchmark results seem to be enough to justify this change. IMO the change is worth it.

@skirpichev
skirpichev restored the decimal-nogc/116946 branch November 2, 2026 11:46
@skirpichev skirpichev reopened this Nov 2, 2026
@skirpichev

Copy link
Copy Markdown
Member Author

I was away for 2 weeks. The benchmark results seem to be enough to justify this change. IMO the change is worth it.

I closed most of my prs. When issues kept open - I don't see a big difference: anyone who interested in the change could reopen pr or ask for it, when CPython team will have enough bandwidth for review.

For the given pr, my concern is here: #116946 (comment).

@skirpichev
skirpichev requested a review from vstinner November 5, 2026 23:12
@vstinner

vstinner commented Nov 6, 2026

Copy link
Copy Markdown
Member

For the given pr, my concern is here: #116946 (comment).

Oh, I forgot how complicated the issue is. I tried to summarize the issue: #116946 (comment).

@skirpichev

Copy link
Copy Markdown
Member Author

Ok, I don't think it worth to keep this open without a clear consensus in the issue thread.

@skirpichev skirpichev closed this Nov 6, 2026
@skirpichev
skirpichev deleted the decimal-nogc/116946 branch November 6, 2026 22:22
@skirpichev
skirpichev restored the decimal-nogc/116946 branch November 7, 2026 08:27
@skirpichev
skirpichev deleted the decimal-nogc/116946 branch November 7, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants