Skip to content

Instantly share code, notes, and snippets.

@aviks
Created October 28, 2017 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aviks/d34a10e46714d637ab73863dabc481ce to your computer and use it in GitHub Desktop.
Save aviks/d34a10e46714d637ab73863dabc481ce to your computer and use it in GitHub Desktop.
DataValues Inference
using DataValues
for n=1:20
a=DataValueArray(rand(2^n))
@time map(x->isnull(x) ? 0.0 : get(x), a);
end
0.090726 seconds (15.83 k allocations: 838.608 KiB)
0.000010 seconds (24 allocations: 1.219 KiB)
0.000011 seconds (62 allocations: 3.156 KiB)
0.000017 seconds (186 allocations: 9.531 KiB)
0.000048 seconds (626 allocations: 33.531 KiB)
0.000115 seconds (2.27 k allocations: 115.031 KiB)
0.000460 seconds (8.64 k allocations: 434.031 KiB)
0.001666 seconds (33.67 k allocations: 1.637 MiB)
0.012756 seconds (132.87 k allocations: 6.383 MiB)
0.066373 seconds (527.87 k allocations: 25.297 MiB, 55.52% gc time)
0.317737 seconds (2.10 M allocations: 100.688 MiB, 65.82% gc time)
2.003672 seconds (8.41 M allocations: 401.188 MiB, 79.76% gc time)
10.821087 seconds (33.59 M allocations: 1.565 GiB, 85.94% gc time)
62.074098 seconds (134.31 M allocations: 6.254 GiB, 90.62% gc time)
julia> a=DataValueArray(rand(100));
julia> typeof(map(x->isnull(x) ? 0.0 : get(x), a))
DataValues.DataValueArray{Any,1}
julia> typeof(map(x->isnull(x) ? 0.0 : x, a))
DataValues.DataValueArray{Float64,1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment