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

[BUG]: Mojo hello world binary size unreasonably large #1751

Closed
albancolley opened this issue Feb 14, 2024 · 8 comments
Closed

[BUG]: Mojo hello world binary size unreasonably large #1751

albancolley opened this issue Feb 14, 2024 · 8 comments
Labels
bug Something isn't working mojo Issues that are related to mojo mojo-repo Tag all issues with this label mojo-tooling Tag for all issues related to repl, lldb, lsp, vscode extension.

Comments

@albancolley
Copy link

Bug description

Binary file large in mojo 0.7.0

Reoccurrence of BUG #599 which was resolved in 0.3.0.

Steps to reproduce

image

System information

WSL2 - Ubuntu 22.04.3 LTS
mojo 0.7.0 (af002202)
modular 0.4.1 (2d8afe15)
@albancolley albancolley added bug Something isn't working mojo Issues that are related to mojo labels Feb 14, 2024
@treeshateorcs
Copy link

treeshateorcs commented Feb 18, 2024

a whopping 4 megabytes before stripping, and 544KB after, here

mojo 0.7.0 (af002202), archlinux

@ematejska ematejska added the mojo-tooling Tag for all issues related to repl, lldb, lsp, vscode extension. label Feb 20, 2024
@River707
Copy link
Collaborator

woof, thanks for filing! We'll take a look at the stripping flags in binary generation

@toiletsandpaper
Copy link
Contributor

Looks like it was fixed in 24.1. On my Mac the binary size is 533 KB after build and 355 KB after strip hello

@River707
Copy link
Collaborator

River707 commented Apr 3, 2024

Yep, this should be fixed now! Please re-open if you still see if you see this again!

@River707 River707 closed this as completed Apr 3, 2024
@SimplyYummy
Copy link

Thanks River. However, doesn't the comment from @toiletsandpaper imply that it's Not fixed? If we need to use the strip command to decrease the binary further, then that means there are still unnecessary symbols making the binary larger?

On macOS, I get a size of 272K for a simple hello.mojo program on version 2024.4.117 (8f6529b0). Then after using strip command the binary is further reduced to 208K.

Could you please clarify if the presence of unnecessary symbols is still an issue?

@River707
Copy link
Collaborator

River707 commented Apr 3, 2024

Yeah, we may have some symbols that could still be stripped further, we'll need to investigate which symbols those are exactly. I marked this as fixed for the original underlying issue of being "unreasonably large"(the several mb was the big issue, digging into the last 60kb is not as pressing). We should open another issue to explore that last mile, but it's good to keep that exploration separate (we do have some symbols that only get used in certain scenarios, but we should certainly try to strip out all symbols that definitely won't be needed).

@SimplyYummy
Copy link

Ah got it. That makes sense. Thanks for clarifying!

@vrakesh
Copy link

vrakesh commented Apr 26, 2024

seems to re-appearing in v24.2.1 @River707

cat world.mojo 
fn main():
    print("Hello world")
$ mojo --version
mojo 24.2.1 (2f0dcf11)
$ mojo build world.mojo
$ ./world 
Hello world
$ du -hs world.mojo 
4.0K	world.mojo
$ du -hs world
4.3M	world
$ uname -a
Linux pop-os 6.8.0-76060800daily20240311-generic #202403110203~1713206908~22.04~3a62479 SMP PREEMPT_DYNAMIC Mon A x86_64 x86_64 x86_64 GNU/Linux


On linux the binary size for hello world is 4.3MB by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo Issues that are related to mojo mojo-repo Tag all issues with this label mojo-tooling Tag for all issues related to repl, lldb, lsp, vscode extension.
Projects
None yet
Development

No branches or pull requests

7 participants