FO
Size: a a a
FO
RS
RS
FO
julia -e "using InteractiveUtils; versioninfo()"ERROR: LoadError: BoundsError: attempt to access 0-element Array{Int64,1} at index [1]
Stacktrace:
[1] setindex! at ./array.jl:766 [inlined]
[2] f4(::Int64) at /dev/shm/benchmark/push_vs_direct.jl:53
[3] top-level scope at /dev/shm/benchmark/push_vs_direct.jl:80
in expression starting at /dev/shm/benchmark/push_vs_direct.jl:80FO
FO
function f4(n)
x = Int[]
sizehint!(x, n)
for i in 1:n
x[i] = i # <- 53 line
end
x
end
KT
FO
FO
KT
FO
Julia Version 1.2.0
Commit c6da87ff4b (2019-08-20 00:03 UTC)
Platform Info:
OS: Linux (x86_64-redhat-linux)
CPU: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
5.520 μs (2 allocations: 78.20 KiB)
44.089 μs (14 allocations: 256.64 KiB)
36.411 μs (2 allocations: 78.27 KiB)
KT
RS
f4(n) # BoundsError
@assert f5(n) == f1(n) # AssertionError
RS
FO
FO

АО
АО