Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert decimal module to use PyLongWriter API #5

Open
wants to merge 2 commits into
base: long_export
Choose a base branch
from

Conversation

skirpichev
Copy link

@skirpichev skirpichev commented Jul 6, 2024

Second commit (patch v2) has a quick path for int64_t-sized integers.

Benchmark master patch patch2
1<<7 651 ns 658 ns: 1.01x slower 531 ns: 1.22x faster
1<<38 747 ns 700 ns: 1.07x faster 533 ns: 1.40x faster
1<<300 2.35 us 2.32 us: 1.01x faster not significant
Geometric mean (ref) 1.02x faster 1.15x faster

Benchmark hidden because not significant (1): 1<<3000

import pyperf
from decimal import Decimal as D

runner = pyperf.Runner()
runner.bench_func('1<<7', int, D(1 << 7))
runner.bench_func('1<<38', int, D(1 << 38))
runner.bench_func('1<<300', int, D(1 << 300))
runner.bench_func('1<<3000', int, D(1 << 3000))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant