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

Compilation time increases too much with array's size #835

Open
tinchoabbate opened this issue Jan 17, 2023 · 1 comment
Open

Compilation time increases too much with array's size #835

tinchoabbate opened this issue Jan 17, 2023 · 1 comment

Comments

@tinchoabbate
Copy link

What is wrong?

The compiler takes too long (practically freezes) when compiling the following code:

contract Test {
    pub fn foo(bar: Array<u256, 10000>) {}
}

I'm running the Mac version, with:

$ fe --version
fe 0.20.0-alpha

$ fe build --output-dir mytest test.fe

It does work with relatively small array sizes. But the bigger the array size, the longer it takes. To the point it's unusable for large ones. Some numbers:

size time
10 0.08 sec
100 0.48 sec
1000 30 sec
10000 killed after +30 min.
@tinchoabbate
Copy link
Author

tinchoabbate commented Jan 17, 2023

Interestingly enough, adding --emit yul speeds things up a lot.

Here's the output I got from compiling the same contract with the --emit yul flag: https://gist.github.com/tinchoabbate/8900ac384c46a87fb843113bab1d56e9

Seems like the generated Yul could use a for loop? Perhaps that's why it's taking too long when compiling to bytecode ?

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

1 participant