Skip to content

implement named return value optimization in the frontend #18363

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
mahkoh opened this issue Oct 27, 2014 · 2 comments
Closed

implement named return value optimization in the frontend #18363

mahkoh opened this issue Oct 27, 2014 · 2 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. I-slow Issue: Problems and improvements with respect to performance of generated code.

Comments

@mahkoh
Copy link
Contributor

mahkoh commented Oct 27, 2014

extern crate test;

pub struct X {
    x: [u8, ..1 << 10],
}

pub fn f() -> X {
    let mut x: X = unsafe { std::mem::uninitialized() };
    for i in range(0, x.x.len()) {
        x.x[i] = i as u8;
    }
    x
}

fn main() {
    let x = f();
    test::black_box(&x);
}

This function needs 2k stack space even though f is being inlined.

@bstrie bstrie added the I-slow Issue: Problems and improvements with respect to performance of generated code. label Oct 27, 2014
@thestinger
Copy link
Contributor

Rust doesn't actually do named return value optimization right now.

@thestinger thestinger added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Oct 28, 2014
@thestinger thestinger changed the title RVO doesn't work implement named return value optimization in the frontend Oct 28, 2014
@steveklabnik
Copy link
Member

I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized.

This issue has been moved to the RFCs repo: rust-lang/rfcs#788

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. I-slow Issue: Problems and improvements with respect to performance of generated code.
Projects
None yet
Development

No branches or pull requests

4 participants