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

Bringing in std::task generates an absurd amount of LLVM bytecode #9813

Closed
alexcrichton opened this issue Oct 11, 2013 · 2 comments
Closed
Labels
I-slow Issue: Problems and improvements with respect to performance of generated code.

Comments

@alexcrichton
Copy link
Member

fn main() {          
    use std::task;   
    task::try(|| {});
}                    

When compiling with optimizations, this program takes nearly three seconds to finish. All of the time is spent in LLVM, and we're generating nearly thirty thousand lines of LLVM bytecode for this tiny function.

It would be great to understand why this is generating so much bytecode, and see if there's a way to reduce it.

@thestinger
Copy link
Contributor

I've looked at the IR and nothing stands out to me as unique to this test case. This is the price of overusing macros, closures, unwinding, not hoisting common code out of generics and making use of reflection (std::repr).

Beyond throwing out the standard library and starting over (rust-core) I don't think this is actionable. The standard library just hasn't been written with attention to code bloat or performance. For example, implementing #8981 would cut down on this a lot but it's not an easy task to migrate the existing code base and deal with code generation hard-wired into the compiler.

@thestinger
Copy link
Contributor

Limiting the use of repr to debug builds would be one example of tackling these systemic issues but I don't think I would be able to get support for making changes like that.

flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 21, 2022
Fix `explicit_auto_deref` fp

fixes rust-lang#9763
fixes rust-lang#9811

changelog: `explicit_auto_deref`: Don't lint when the target type is a projection with generic arguments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-slow Issue: Problems and improvements with respect to performance of generated code.
Projects
None yet
Development

No branches or pull requests

2 participants