You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found a performance issue with enumerate. Here is my version information:
Julia Version 0.6.0 Commit 9036443 (2017-06-19 13:05 UTC) Platform Info: OS: Linux (x86_64-pc-linux-gnu) CPU: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz WORD_SIZE: 64 BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell) LAPACK: libopenblas64_ LIBM: libopenlibm LLVM: libLLVM-3.9.1 (ORCJIT, haswell)
The following code compares the execution time of enumerate and an iterator with a manually defined index. As you will see, enumerate is about 4-5 times slower.
using BenchmarkTools
type Person
id::Int
end
function getID1(people)
ids = fill(0,size(people,1))
for (i,p) in enumerate(people)
ids[i] = p.id
end
return ids
end
function getID2(people)
ids = fill(0,size(people,1))
i = 0
for p in people
i += 1
ids[i] = p.id
end
return ids
end
people = [Person(id) for id in 1:1000]
v1 = @benchmarkable getID1(people)
tune!(v1)
r1 = run(v1)
v2 = @benchmarkable getID2(people)
tune!(v2)
r2 = run(v2)
I found a performance issue with
enumerate
. Here is my version information:Julia Version 0.6.0 Commit 9036443 (2017-06-19 13:05 UTC) Platform Info: OS: Linux (x86_64-pc-linux-gnu) CPU: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz WORD_SIZE: 64 BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell) LAPACK: libopenblas64_ LIBM: libopenlibm LLVM: libLLVM-3.9.1 (ORCJIT, haswell)
The following code compares the execution time of
enumerate
and an iterator with a manually defined index. As you will see,enumerate
is about 4-5 times slower.Here are the results for
enumerate
:And the results for the corresponding manual indexing:
The text was updated successfully, but these errors were encountered: