The way I came to understand was to just take a peak at the [source code]( https://github.com/JuliaLang/julia/blob/ae154d076a6ae75bfdb9a0a377a6a5f9b0e1096f/src/array.c#L670); I find it pretty legible. The basic idea is that the underlying "storage" of a Julia Array{T,N} can actually be (and often is) different than the size(A) in Julia. sizehint! modifies that underlying storage without changing the size(A) in Julia.
-Jacob On Wed, Oct 21, 2015 at 12:46 PM, Seth <[email protected]> wrote: > I know it's good to use sizehint! with an estimate of the sizes of > (variable-length) containers such as vectors, but I have a couple of > questions I'm hoping someone could answer: > > 1) what are the benefits of using sizehint!? (How does it work, and under > what circumstances is it beneficial?) > 2) what are the implications (positive/negative, if any) of overestimating > the size of a container? > > Thanks. >
