Saying it again #julialang is not like #python or some other dynamic language. Using types doesn't really make your code fast
Adding type annotations serves three primary purposes: to take advantage of Julia's powerful multiple-dispatch mechanism, to improve human readability, and to catch programmer errors.
Julia’s JIT compiler makes the code fast regardless of the type-constraints. Read more here: https://www.oxinabox.net/2020/04/19/Julia-Antipatterns.html#over-constraining-argument-types
See you don't need to type annotate #julialang like Cython to speed up things. C like speed Python like syntax
![]()
@abhi_jl
also unless 👇
you're defining a type i.e. a struct, in which case specifying the types does help a lot with performance. In particular, specifying non-abstract concrete types for the fields of the struct. Since this lets #JuliaLang know how much memory your struct is going to need, which allows it to generate optimized code. See: https://docs.julialang.org/en/v1/manual/performance-tips/#Type-declarations
@abhi_jl @digital_carver types may not matter but type stability matters.
@athulsudheesh @digital_carver can you please elaborate what you mean by type stability here?
@athulsudheesh @digital_carver for context this thread is a follow to my conversion with Lorenz when I asked him why fastai.jl doesn't have type casting
@digital_carver