perf: use new PyLong* API for num-bigint feature#6144
Conversation
Merging this PR will improve performance by 84.46%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | into_bigint_huge_negative |
24.1 µs | 6.6 µs | ×3.6 |
| ⚡ | extract_biguint_small |
2,440.3 ns | 708.6 ns | ×3.4 |
| ⚡ | extract_biguint_zero |
2,499.4 ns | 737.8 ns | ×3.4 |
| ⚡ | extract_biguint_negative_fail |
7.2 µs | 2.3 µs | ×3.2 |
| ⚡ | extract_bigint_small |
2,568.9 ns | 827.2 ns | ×3.1 |
| ⚡ | into_bigint_huge_positive |
17.9 µs | 6.6 µs | ×2.7 |
| ⚡ | into_biguint_huge |
17.7 µs | 6.6 µs | ×2.7 |
| ⚡ | into_bigint_big_negative |
5.4 µs | 2.1 µs | ×2.5 |
| ⚡ | into_bigint_small |
3.3 µs | 1.5 µs | ×2.2 |
| ⚡ | into_bigint_big_positive |
4.7 µs | 2.2 µs | ×2.1 |
| ⚡ | into_biguint_big |
4.5 µs | 2.2 µs | ×2.1 |
| ⚡ | into_biguint_small |
3.5 µs | 2 µs | +76.77% |
| ⚡ | extract_bigint_huge_negative |
13.1 µs | 8.5 µs | +54.92% |
| ⚡ | into_biguint_zero |
2.9 µs | 1.9 µs | +48.13% |
| ⚡ | extract_bigint_huge_positive |
11.8 µs | 8.5 µs | +39.63% |
| ⚡ | extract_biguint_huge |
11.8 µs | 8.6 µs | +37.04% |
| ⚡ | extract_i128_small_pos |
1,073.6 ns | 862.5 ns | +24.48% |
| ⚡ | extract_i128_zero |
1,102.8 ns | 891.7 ns | +23.68% |
| ⚡ | extract_i128_small_neg |
1,165.8 ns | 954.7 ns | +22.11% |
| ⚡ | extract_bigint_big_negative |
4.1 µs | 3.4 µs | +19.51% |
| ... | ... | ... | ... | ... |
ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing chirizxc:PyLongForBigInt (cfd9cec) with main (9e6697d)
davidhewitt
left a comment
There was a problem hiding this comment.
Thanks, generally looks good on the from-python implementation; I think possible gains yet to be had in the to-python implementation.
|
Also, I think worth giving this a |
PyLong API for num-bigint featurePyLong* API for num-bigint feature
Related: #6040
See codspeed comment for benchmark improvements.