Skip to content

Use the inline definition of Py_TYPE in the unlimited API on 3.14+#6179

Merged
davidhewitt merged 1 commit into
PyO3:mainfrom
exg:inline-py-type-in-unlimited-api
Jul 2, 2026
Merged

Use the inline definition of Py_TYPE in the unlimited API on 3.14+#6179
davidhewitt merged 1 commit into
PyO3:mainfrom
exg:inline-py-type-in-unlimited-api

Conversation

@exg

@exg exg commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@codspeed-hq

codspeed-hq Bot commented Jul 1, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 22.31%

⚡ 10 improved benchmarks
✅ 130 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
extract_u128_small 1,200.8 ns 956.9 ns +25.49%
extract_u128_zero 1,230 ns 986.1 ns +24.73%
extract_i128_small_pos 1.3 µs 1 µs +24.02%
extract_i128_zero 1.3 µs 1 µs +23.35%
extract_u128_u32_max 1.3 µs 1.1 µs +23.03%
extract_i128_small_neg 1.4 µs 1.1 µs +22.02%
extract_u128_u64_max 1.4 µs 1.2 µs +20.83%
extract_u128_max 1.4 µs 1.2 µs +20.29%
extract_i128_pos_max 1.5 µs 1.2 µs +19.79%
extract_i128_neg_min 1.5 µs 1.2 µs +19.76%

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 exg:inline-py-type-in-unlimited-api (cfe0f23) with main (e2f8fb9)

Open in CodSpeed

@ngoldbaum

Copy link
Copy Markdown
Contributor

@exg mentioned on discord that they saw ~10% speedup in an ormsgpack benchmark with this change.

@davidhewitt does using the direct field access on version-specific builds seem OK too you?

@davidhewitt davidhewitt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me, and is consistent with the headers.

(Seems like exactly the sort of performance advantage permissible from the version-specific builds.)

@davidhewitt davidhewitt added this pull request to the merge queue Jul 2, 2026
Merged via the queue into PyO3:main with commit e61712f Jul 2, 2026
50 checks passed
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.

3 participants