title: Is Julia's Vector{Vector{T}} stored contiguously in memory?
body: <p>To motivate my question, consider the case when dealing with <a href="https://en.wikipedia.org/wiki/Jagged_array" rel="noreferrer">jagged arrays</a> (for simplicity's sake) of element type <code>Int</code> in Julia. There are two ways to store them:</p>
  
  <ol>
  <li>As <code>Vector{Vector{Int}}</code></li>
  <li>As <code>Vector{Union{Vector{Int}, Int}}</code> (especially, if one expects to store a sufficiently large number of 1-element vectors)</li>
  </ol>
  
  <p>My question is which one is more efficient / faster / better?</p>
  
  <p>To answer it, among the other things, I need to know how each is stored in memory. Namely:</p>
  
  <ol>
  <li><p>I presume that variable of a type <code>Vector{Vector{Int}}</code>, would be considered homogeneous type array, and therefore I would expect it to be stored <em>contiguously</em> in memory, and as such to be more cpu-cache-friendly. Am I right? Or contiguity only applies to arrays whose elements' data type is primitive?</p></li>
  <li><p>Would variable of a type <code>Vector{Union{Vector{Int}, Int}}</code> considered heterogeneous array, and as such stored <strong>not</strong> <em>contiguously</em> in memory?</p></li>
  <li><p>How benefit of contiguous representation in memory is compared to the benefit of not having array container for 1-element arrays members, i.e. storing them as primitive data type (<code>Int</code> in this case)? Which one yields more efficiency?</p></li>
  </ol>