Skip to content

build(python): build pyiceberg-core wheel with opt-level = 3 - #3653

Merged
kevinjqliu merged 2 commits into
apache:mainfrom
mbutrovich:pyiceberg-core-opt-level-3
Nov 10, 2026
Merged

kevinjqliu merged 2 commits into
apache:mainfrom
mbutrovich:pyiceberg-core-opt-level-3

Conversation

@mbutrovich

Copy link
Copy Markdown
Collaborator

Which issue does this PR close?

What changes are included in this PR?

Sizes on macOS arm64 at 5370b61, with the toolchain from rust-toolchain.toml:

opt-level strip Wheel .so
"z" true 1.2 MB 3.1 MB
3 false 1.8 MB 5.6 MB

I did not build the manylinux wheels or check the macos-latest CI runners.

Are these changes tested?

N/A.

AI Disclosure

I wrote this PR with help from Claude but understand and support the core approach, implementation, and test coverage.

@mbutrovich
mbutrovich marked this pull request as ready for review November 9, 2026 12:16

@kevinjqliu kevinjqliu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

These settings were originally picked to shrink large wheels (#1841, #1844). I think it's a good time to prioritize library speed over build time and wheel size. 😄

The opt-level = 3 change lets the compiler favor runtime speed rather than smaller code. I reproduced the benefit locally on this revision: ~2x faster parsing and ~1.5x faster parsing plus conversion into PyIceberg objects, with the wheel growing from 1.25 to 1.78 MB. That's a pretty good tradeoff to me.

The strip = false change is a compatibility workaround. I reproduced the macOS import failure with stripping enabled and the Arrow bindings included.

@kevinjqliu
kevinjqliu added this pull request to the merge queue Nov 10, 2026
@kevinjqliu

Copy link
Copy Markdown
Contributor

Thanks @mbutrovich

Merged via the queue into apache:main with commit 63d3d52 Nov 10, 2026
24 checks passed
@mbutrovich
mbutrovich deleted the pyiceberg-core-opt-level-3 branch November 10, 2026 01:46
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.

Build the pyiceberg-core wheel with opt-level = 3

2 participants