Skip to content

Compiling code containing very long arrays takes, a strangely long amount of time. #6484

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

Closed
mstewartgallus opened this issue May 14, 2013 · 6 comments

Comments

@mstewartgallus
Copy link
Contributor

In order to compile resources into my application statically, I automatically generate very long arrays. These take an extremely long amount of time to compile.

@Thiez
Copy link
Contributor

Thiez commented May 15, 2013

Do you have some example code that shows this problem in action? How long is 'very long'?

@mstewartgallus
Copy link
Contributor Author

@Thiez Sure, I'd be happy to give you an example of the code. I just didn't attach it because it is very long, and boring, and an alternative is easily auto-generated. Here's a link to a gist https://gist.github.com/sstewartgallus/5587348

@Thiez
Copy link
Contributor

Thiez commented May 15, 2013

It seems the compiler is making LLVM generate an enormous number of moves, which LLVM then tries to optimize (without much success). I think this is related to #3025.

As a workaround you might try to put the contents of the SpriteList in a top-level static, then generate the 'real' SpriteList from the static structure with many calls to to_owned (core::vec). Hopefully this will generate better code.

@mstewartgallus
Copy link
Contributor Author

@Thiez Unfortunately, I can not create a top level static structure that has arrays due to issue #5917

@msullivan
Copy link
Contributor

How long was it taking? Not sure the best way to deal with this. I seem to recall C compilers sometimes being unhappy with huge arrays as well...

@thestinger
Copy link
Contributor

As far as I know, these issues have been fixed and we generate loops whenever possible. There would need to be a reproducible test case comparing rustc and clang unfavourably for it to be considered an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants