-
Notifications
You must be signed in to change notification settings - Fork 554
Reduce size of cc::Build and size of generated targets
#1257
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
Conversation
This would also reduce heap fragmentation. Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Also add caching of parsing of the `TargetInfo` from cargo env. Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
| /// See <https://doc.rust-lang.org/cargo/appendix/glossary.html#target>. | ||
| #[derive(Debug, PartialEq, Clone)] | ||
| pub(crate) struct TargetInfo { | ||
| pub(crate) struct TargetInfo<'a> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @madsmtm This is the optimization I was proposing, can you take a look and confirm this looks good please?
madsmtm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't have a strong preference for either version (in favour is that matching on &str is nicer, against is that we have to maintain the list of struct fields).
| }; | ||
|
|
||
| #[derive(Debug)] | ||
| struct TargetInfoParserInner { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
| struct TargetInfoParserInner { | |
| struct ParsedTargetInfo { |
(Or OwnedTargetInfo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmmm I think Inner suffix is ok, if we want to rename it we probably want to rename the other one as well.
True we need that extra field maintenance, but that would make the generated binary smaller. AFAIK Given that we use |
|
P.S. I think that some crates use cc-rs at runtime as a normal dep, so this should reduce their binary size. |
No description provided.