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

Very slow compiler performance with long function and many list comprehensions #6685

Closed
GlenHertz opened this issue Apr 29, 2014 · 8 comments
Labels
compiler:latency Compiler latency

Comments

@GlenHertz
Copy link
Contributor

Hi,

I'm tried to strip down an example to something small but I was left with a function that makes no sense but shows the performance issue. It takes about 4 seconds and half a GB of memory to compile this function. The testcase is available here:

https://gist.github.com/GlenHertz/11387643#file-slow_performance-jl

I tried to add type annotations to speed things up but it didn't help.

Thanks,

Glen

@JeffBezanson
Copy link
Member

Are the types with lots of fields relevant to this effect, or is it just the comprehensions?

@GlenHertz
Copy link
Contributor Author

I don't think the types are relevant. It seems to be a combination of a
long function body (if I split it into smaller functions it helps) and the
comprehensions.

On Tue, Apr 29, 2014 at 4:04 PM, Jeff Bezanson [email protected]:

Are the types with lots of fields relevant to this effect, or is it just
the comprehensions?


Reply to this email directly or view it on GitHubhttps://github.com//issues/6685#issuecomment-41725058
.

@vtjnash
Copy link
Member

vtjnash commented May 3, 2014

Here's a version that only has one field. It's a little longer and a little faster, but still shows super-linear (super-quadratic?) growth in type-inference time.

The parse time of this function is also very bad (12 seconds).

https://gist.github.com/vtjnash/27ff622b2cbed22b51dc

Perhaps the number of SSA variables (1898) is causing issues?

As a random side note, when using the type with with 80-fields, type inference takes about 10% longer (e.g. 4.5 instead of 4 seconds) if all of the comprehensions are on f80 instead of f1.

(ps. timings were done on my jn/inline_partialmatch branch)

@quinnj
Copy link
Member

quinnj commented Aug 14, 2014

Has this been helped by the work in #7977?

@JeffBezanson
Copy link
Member

Nope. It's just that the function has 3000 statements and over a thousand variables.

@KristofferC
Copy link
Member

This takes 2 seconds to compile and 80 MB memory. Can this be closed?

@vtjnash
Copy link
Member

vtjnash commented May 24, 2017

Yes. Would be nice to use examples like this to start adding compile and parse time tests to Nanosoldier's BaseBenchmarks.jl.

@KristofferC KristofferC added the potential benchmark Could make a good benchmark in BaseBenchmarks label May 24, 2017
@KristofferC KristofferC added compiler:latency Compiler latency and removed performance Must go faster labels Oct 23, 2018
@KristofferC
Copy link
Member

@time println(t)  # about 4 sec, 550MB

is now

 1.365269 seconds (2.69 M allocations: 147.406 MiB, 5.61% gc time)

Not sure what the criteria is to close this so I will just do that. Feel free to reopen.

@KristofferC KristofferC removed the potential benchmark Could make a good benchmark in BaseBenchmarks label Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:latency Compiler latency
Projects
None yet
Development

No branches or pull requests

6 participants