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

Optimize and strip Cython compiled libraries #3310

Merged
merged 1 commit into from Nov 14, 2022

Conversation

rcurtin
Copy link
Member

@rcurtin rcurtin commented Nov 11, 2022

This modifies the Python binding build configuration to compile without debugging symbols, and strip the compiled libraries. This can help result in significantly smaller wheels. Compared to mlpack 3.4.2, the compiled libraries in the Python wheel are 10x smaller; part of that has to do with this patch, part of it has to do with all the other changes that have happened since mlpack 3.4.2.

The -g0 option overrides any previous setting of -g; this is necessary because Cython by default will compile with -g (which is maybe a little bit of a confusing choice to me, but oh well).

Copy link
Member

@shrit shrit left a comment

Choose a reason for hiding this comment

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

LGTM, this is a cool PR, wonder why we did not do it before?

Copy link

@mlpack-bot mlpack-bot bot left a comment

Choose a reason for hiding this comment

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

Second approval provided automatically after 24 hours. 👍

@rcurtin
Copy link
Member Author

rcurtin commented Nov 14, 2022

I hadn't realized that Cython was compiling with -g, actually. Anyway, the -Wl,--strip-all option might be interesting to play around with for cross-compilation too.

@rcurtin rcurtin merged commit 3fdb791 into mlpack:master Nov 14, 2022
@rcurtin rcurtin mentioned this pull request Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants