Skip to content

Convert decimal module to use PyLongWriter API - #5

Closed
skirpichev wants to merge 2 commits into
vstinner:long_exportfrom
skirpichev:long_export-decimal
Closed

skirpichev wants to merge 2 commits into
vstinner:long_exportfrom
skirpichev:long_export-decimal

Conversation

@skirpichev

@skirpichev skirpichev commented Jul 6, 2024 •

Copy link
Copy Markdown

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

Details
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