-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Inference: slow for for loop, fast for corresponding while #16122
Comments
are you testing this at the toplevel? what if you put both in a function? |
Hmm. Then it's fast. (Thought I'd tested that, but evidently not.) So may not be an inference thing? |
With regards to closing: perhaps it's worth emphasizing that this is a 2x2 matrix, and that 30 seconds is quite a long time to wait for looping over all of its elements. Since compilation is fast when it's in a function, it's also not an inescapable compilation overhead. In other words, this is likely not your run-of-the-mill "avoid globals, put it in a function" problem. OK to reopen? |
IIUC what this was doing, it's fast now:
|
where
slow1.jl
is defined asIn contrast, in a fresh session
where
slow2
is the manually-expanded while loop version,The text was updated successfully, but these errors were encountered: