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

[reduce size] Very large resulting library file for compute1 crate #386

Open
philippeitis opened this issue Oct 19, 2022 · 4 comments
Open

Comments

@philippeitis
Copy link
Collaborator

Updating crates.io index
   Compiling google-compute1 v5.0.1+20220224 (/.../google-apis-rs/gen/compute1)
    Finished dev [unoptimized + debuginfo] target(s) in 43.67s

This produces a 181MB (debug) / 168MB (release) library file.

This issue is intended to track progress over time - ideally, this library should be a good bit smaller.

@philippeitis philippeitis changed the title compute1 Very large resulting library file for compute1 crate Oct 19, 2022
@Byron Byron changed the title Very large resulting library file for compute1 crate [reduce size] Very large resulting library file for compute1 crate Oct 20, 2022
@Byron
Copy link
Owner

Byron commented Oct 20, 2022

For the rlib file after building with make compute1-cargo ARGS=build I get 166MB in debug mode, but wanted to put it to the test with make compute1-cli-cargo ARGS=build to see what binary sizes we get.

Unfortunately it looks like a regression snuck in to the CLI generator with this (and 2 more errors just like it):

error[E0308]: mismatched types
      --> src/main.rs:15954:39
       |
15954  |                     call = call.start(value.unwrap_or(""));
       |                                 ----- ^^^^^^^^^^^^^^^^^^^ expected `i64`, found `&str`
       |                                 |
       |                                 arguments to this function are incorrect
       |
note: associated function defined here
      --> /Users/byron/dev/github.com/Byron/google-apis-rs/gen/compute1/src/api.rs:107880:12
       |
107880 |     pub fn start(mut self, new_value: i64) -> InstanceGetSerialPortOutputCall<'a, S> {

Probably the CLI generator doesn't yet know about the improved types that were recently introduced, and I'd love it if that could be fixed. From there it should be possible to get values for release binaries that make use of every possible call, i.e. the worst case scenario.

@Byron
Copy link
Owner

Byron commented Oct 20, 2022

It looks like the upgrade to mime also broke the CLI, and it's clearly my oversight as I didn't run make cargo-cli ARGS=check at all after running make cargo-api ARGS=check. Doing so should probably be the default from now on.

@Byron
Copy link
Owner

Byron commented Oct 20, 2022

The debug build of compute3-cli is 108MB (MacOS) and 52MB stripped. The release build is still… running 😅 (4.2GB in memory).

@Byron
Copy link
Owner

Byron commented Oct 21, 2022

42 minutes later, there was a release binary of compute1 with 31MB and 27MB stripped. Not too bad (except for the compile time, which is probably the main reason these crates should get slimmer).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants