Hacker News new | ask | show | jobs
by kbarros 484 days ago
> We've had test code that goes from taking 10 minutes to run to over 2 hours because of type instability in a single line of code.

For those who might not be familiar, tooling can sometimes help a lot here. The ProfileView.jl package (or just calling the @profview macro in VSCode) will show an interactive flamegraph. Type instabilities are highlighted in red and memory allocations are highlighted in yellow. This will help to identify the exact line where the type instability or allocation occurs. Also, to prevent regressions, I really like using the JET.jl static analysis package in my unit tests.

1 comments

If they are so easy to identify, why not just make it a JIT error. Manually inspecting all of this sounds awful. I'd rather my compiler just do it for me.
Dynamic behaviors can be a nice default for all the spots where performance is not critical. So Julia lets you code like Python in places where performance doesn't matter, and then code like C++ or Fortran in places where it does.
Because there's nothing inherently wrong or incorrect with dynamic behaviour. In lots of contexts, it's super useful.