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
mod. and floor. in combination are much slower than if both are seperated:
@benchmark mod.(floor.(Int,1:0.1:20000),1000)
BenchmarkTools.Trial:
memory estimate: 12.09 MiB
allocs estimate: 692465
--------------
minimum time: 16.307 ms (0.00% GC)
median time: 17.317 ms (4.88% GC)
mean time: 17.368 ms (3.04% GC)
maximum time: 23.773 ms (0.00% GC)
--------------
samples: 288
evals/sample: 1
@benchmark begin
c = floor.(Int,1:0.1:20000)
mod.(c,1000)
end
BenchmarkTools.Trial:
memory estimate: 3.05 MiB
allocs estimate: 4
--------------
minimum time: 1.412 ms (0.00% GC)
median time: 1.479 ms (0.00% GC)
mean time: 1.615 ms (6.02% GC)
maximum time: 3.623 ms (22.50% GC)
--------------
samples: 3092
evals/sample: 1
versioninfo()
Julia Version 0.6.0
Commit 903644385b* (2017-06-19 13:05 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
WORD_SIZE: 64
BLAS: libblas
LAPACK: liblapack
LIBM: libm
LLVM: libLLVM-4.0.0 (ORCJIT, skylake)
BTW here are the results if I do it the other way round:
@benchmark floor.(Int, mod.(1:0.1:20000,1000))
BenchmarkTools.Trial:
memory estimate: 1.53 MiB
allocs estimate: 2
--------------
minimum time: 3.304 ms (0.00% GC)
median time: 3.397 ms (0.00% GC)
mean time: 3.462 ms (0.86% GC)
maximum time: 5.196 ms (0.00% GC)
--------------
samples: 1444
evals/sample: 1
@test floor.(Int, mod.(1:0.1:20000,1000)) == mod.(floor.(Int,1:0.1:20000),1000)
Test Passed
The text was updated successfully, but these errors were encountered:
julia> @btime mod.(floor.(Int,1:0.1:20000),1000);
1.400 ms (2 allocations: 1.53 MiB)
julia> @btime begin
c = floor.(Int,1:0.1:20000)
mod.(c,1000)
end
1.249 ms (4 allocations: 3.05 MiB)
mod. and floor. in combination are much slower than if both are seperated:
BTW here are the results if I do it the other way round:
The text was updated successfully, but these errors were encountered: