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

Make Error use NonZero for its value #1120

Open
Darksonn opened this issue Sep 27, 2024 · 1 comment
Open

Make Error use NonZero for its value #1120

Darksonn opened this issue Sep 27, 2024 · 1 comment
Labels
• lib Related to the `rust/` library.

Comments

@Darksonn
Copy link
Collaborator

Currently, the type Result<(), Error> takes up twice the size that it needs to. By changing the type inside Error to be the appropriate NonZero* type will make the niche optimization apply to reduce the size.

Related to #195.

@ojeda ojeda added the • lib Related to the `rust/` library. label Sep 27, 2024
@felipeagger
Copy link

I will work on it.

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Oct 3, 2024
Optimize `Result<(), Error>` size by changing `Error` type to
`NonZero*` for niche optimization.

This reduces the space used by the `Result` type, as the `NonZero*`
type enables the compiler to apply more efficient memory layout.
For example, the `Result<(), Error>` changes size from 8 to 4 bytes.

Link: Rust-for-Linux#1120
Signed-off-by: Filipe Xavier <felipe_life@live.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Oct 3, 2024
Optimize `Result<(), Error>` size by changing `Error` type to
`NonZero*` for niche optimization.

This reduces the space used by the `Result` type, as the `NonZero*`
type enables the compiler to apply more efficient memory layout.
For example, the `Result<(), Error>` changes size from 8 to 4 bytes.

Link: Rust-for-Linux#1120
Signed-off-by: Filipe Xavier <felipe_life@live.com>
intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Oct 5, 2024
Optimize `Result<(), Error>` size by changing `Error` type to
`NonZero*` for niche optimization.

This reduces the space used by the `Result` type, as the `NonZero*`
type enables the compiler to apply more efficient memory layout.
For example, the `Result<(), Error>` changes size from 8 to 4 bytes.

Link: Rust-for-Linux#1120
Signed-off-by: Filipe Xavier <felipe_life@live.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
• lib Related to the `rust/` library.
Development

No branches or pull requests

3 participants