Hacker News new | past | comments | ask | show | jobs | submit login

>sometimes you don't know if some missing type annotation is slowing your program

The lack of type annotations won't slow down your Julia program, since the compiler will infer them anyway (types are for multiple dispatch, documentation or to assert types, not speed). What will affect it is if the type can be inferred or not. For example, if you have a variable that is sometimes an int, sometimes a float, sometimes a string it will force the compiler to put the checks on runtime, dropping performance to CPython level (although the compiler optimizes small unions, such as Union{Int, Nothing} for a nullable Int). That's what the community calls type-stability, and the first step of profiling a function is usually using the macro @code_warntype to see what the compiler is inferring. See:

https://docs.julialang.org/en/latest/manual/performance-tips...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: