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

Track permissions as bytes #540

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

workingjubilee
Copy link
Member

Because we expect certain inputs, we don't need chars. The code also doesn't need to validate exact lengths. This reduces the generated code size slightly.

I have some more exciting experiments which I am hoping may take off more in final Rust binaries, but which increase the intermediate rlib by more, so this is the only unequivocal win.

@ChrisDenton
Copy link
Member

This looks great to me.

I take it perms aren't actually used anywhere except the test atm? I guess I'm wondering why we store all this stuff when only address and pathname appear to be used? Unless I'm missing something.

@workingjubilee
Copy link
Member Author

workingjubilee commented Jul 3, 2023

We need to parse up to the pathname anyways, in order to be confident the parse is correct. However, once we have done so, we can simply discard this information, yes. I experimented with doing that but the generated rlib got bigger, surprisingly, and I figured it might reduce the final built and optimized size, but that required shoving it inside the stdlib and actually building a binary to test so I deferred that.

Copy link
Member

@ChrisDenton ChrisDenton left a comment

Choose a reason for hiding this comment

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

Fair enough!

@workingjubilee
Copy link
Member Author

I'm going to hold onto this PR since it almost certainly should result in a (small) final-binary diff until either @Kobzol or myself fix the CI check so graciously added, apologies for the noise.

Because we expect certain inputs, we don't need chars.
The code also doesn't need to validate exact lengths.
This reduces the generated code size slightly.
@github-actions
Copy link

github-actions bot commented Jul 6, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 512760B
Updated binary size: 513184B
Difference: +424B (0.08%)

@workingjubilee
Copy link
Member Author

That sounds unlikely!

@workingjubilee
Copy link
Member Author

However, more importantly: it sounds! Thanks, @Kobzol!

@Kobzol
Copy link
Contributor

Kobzol commented Jul 6, 2023

Did you expect a larger increase? Currently we just compile a hello world program with panic!() with -O. We could try other things, like -Copt-level=s or strip.

@workingjubilee
Copy link
Member Author

I expected a decrease, actually! Let me tinker with the build settings, then.

@workingjubilee
Copy link
Member Author

First pass: Let's try my hypothesis that discarding all the fields will decrease the built size.

@github-actions
Copy link

github-actions bot commented Jul 6, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 513528B
Difference: +400B (0.08%)

@github-actions
Copy link

github-actions bot commented Jul 6, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 513528B
Difference: +400B (0.08%)

@workingjubilee
Copy link
Member Author

Okay, opt-level doesn't make a difference, but 24 bytes less means I am on to something! Maybe!

@github-actions
Copy link

github-actions bot commented Jul 6, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 513520B
Difference: +392B (0.08%)

@github-actions
Copy link

github-actions bot commented Jul 6, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 513720B
Difference: +592B (0.12%)

@github-actions
Copy link

github-actions bot commented Jul 6, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 515056B
Difference: +1928B (0.38%)

@workingjubilee
Copy link
Member Author

well that backfired lmao.

@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 513200B
Difference: +72B (0.01%)

@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 513928B
Difference: +800B (0.16%)

@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 513712B
Difference: +584B (0.11%)

1 similar comment
@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 513712B
Difference: +584B (0.11%)

@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 513712B
Difference: +584B (0.11%)

@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 513200B
Difference: +72B (0.01%)

This may eliminate some of the overhead of a getter.
Also use a slightly more modern code style.
@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 513200B
Difference: +72B (0.01%)

@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 513216B
Difference: +88B (0.02%)

1 similar comment
@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 513216B
Difference: +88B (0.02%)

@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 513208B
Difference: +80B (0.02%)

@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Below is the size of a hello-world Rust program linked with libstd with backtrace.

Original binary size: 513128B
Updated binary size: 515184B
Difference: +2056B (0.40%)

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.

3 participants