-
-
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
Warning about type instability on demand during compilation #30155
Comments
[1] Inherently |
I'm not saying that this information is otherwise unavailable. It would just be so much more immediate if I could simply run my code with something like |
Outputting this for every function would likely get very spammy so you would need to indicate certain blocks. And that is covered by #10980. |
The output could be very much reduced compared to the |
And, this would obviously not apply to pre-compiled stuff. |
I think you might be surprised at how noisy such a mode would be. There's a fairly substantial amount of code that either ignores types, or would run worse if it tried to get them at compile-time. As @vchuravy mentioned, usually actually only a small portion of code really benefits that much from compile-time propagation of type information (although that portion benefits from it quite greatly). |
If you think it is a bad idea, I have no objection if you close this issue. On the other hand, if this would make it more likely that performance issues due to type instability might be easier to catch (with a little bit of care to control the amount of output, for instance by enabling it in a block, not globally), would that be easy to do? |
Future discussion can likely be made in #10980. |
Given that we now have union-splitting, typically you don't even care about type-instability per se---it's really runtime dispatch that causes the performance hit. The best thing to do is run the profiler and then look for top-level red bars in ProfileView. That makes it easy to spot runtime dispatch, while also limiting your investigations to things that actually matter for performance. |
Thanks for the union-splitting blog write-up. Interesting stuff... |
This is a suggestion for enhancement:
The compiler has I believe sufficient information about type instability when a particular method gets compiled. Would it be possible to implement an option to produce a warning message during compilation that the method was type-unstable? For instance, the names of the variables that were found type-unstable could be reported (together with the line information).
This warning printouts could be enabled by a command-line flag, so that the warning would only be printed when the user desired it.
The text was updated successfully, but these errors were encountered: