Serialization compresses very well?

It’s interesting to observe the size of an array of string data (in Julia 0.7):

  • In memory => 22 MB
  • Serialized => 8 MB
  • JLD2 => 40 MB
julia> x = [randstring(6) for _ in 1:1000000];

julia> Base.summarysize(x)
22000040

julia> open("/tmp/x.jo", "w") do file serialize(file, x) end

julia> @save "/tmp/x.jld2" x

shell> ls -l /tmp/
-rw-r--r--  1 tomkwong  wheel   40001228 Aug 16 22:43 x.jld2
-rw-r--r--  1 tomkwong  wheel    8000016 Aug 16 22:43 x.jo