Array internals in Julia
We discussed how Julia's performance comes out of using type information to compile specific and fast machine code for different data types. Nowhere is this more apparent than in array-related code. This is probably where all of Julia's design choices pay off in creating high-performance code.
Array representation and storage
An array type in Julia is parameterized by the type of its elements and the number of its dimensions. Hence, the type of an array is represented as Array{T, N}
, where T
is the type of its elements, and N
is the number of dimensions. So, for example, Array{UTF8String, 1}
is a one-dimensional array of strings, while Array{Float64,2}
is a two-dimensional array of floating point numbers.
Tip
Type parameters
You must have realized that type parameters in Julia do not always have to be other types; they can be constant values as well. This makes Julia's type system enormously powerful. It allows the type system to represent complex relationships and...