Skip to content

Instantly share code, notes, and snippets.

@julialang-jenkins
Created December 22, 2014 00:33
Show Gist options
  • Save julialang-jenkins/5770d1d46809c93c132d to your computer and use it in GitHub Desktop.
Save julialang-jenkins/5770d1d46809c93c132d to your computer and use it in GitHub Desktop.
test (yomichi)
elapsed time: 0.004406706 seconds (245648 bytes allocated)
elapsed time: 0.003491785 seconds (231920 bytes allocated)
function collatz_branch(N::Integer)
i = 0
while N > 1
N = iseven(N) ? div(N,2) : 3N+1
i += 1
end
return i
end
function collatz_select(N::Integer)
i = 0
while N > 1
N = ifelse(iseven(N), div(N,2), 3N+1)
i += 1
end
return i
end
test_branch(Ns::Vector{Int}) = map(collatz_branch, Ns)
test_select(Ns::Vector{Int}) = map(collatz_select, Ns)
gc_disable()
test_branch([1:10])
test_select([1:10])
const N = (length(ARGS) > 0 ? int(ARGS[1]) : 10000)
const Ns = [1:N]
@time test_branch(Ns)
@time test_select(Ns)
Julia Version 0.4.0-dev+2227
Commit d6514f4 (2014-12-21 13:30 UTC)
Platform Info:
System: Linux (x86_64-linux-gnu)
CPU: Intel Xeon E312xx (Sandy Bridge)
WORD_SIZE: 64
Ubuntu 12.04.5 LTS
uname: Linux 3.2.0-70-generic #105-Ubuntu SMP Wed Sep 24 19:49:16 UTC 2014 x86_64 x86_64
Memory: 0.9721298217773438 GB (65.3984375 MB free)
Uptime: 2.457314e6 sec
Load Avg: 0.1591796875 0.052734375 0.05517578125
Intel Xeon E312xx (Sandy Bridge):
speed user nice sys idle irq
#1 2499 MHz 8486447 s 4690 s 1901287 s 233937784 s 468 s
#2 2499 MHz 7127542 s 221 s 1854092 s 236128053 s 0 s
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
LAPACK: libopenblas
LIBM: libopenlibm
LLVM: libLLVM-3.3
Environment:
JENKINS_HOME = /var/lib/jenkins
LD_LIBRARY_PATH = /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/server:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64:/usr/lib/jvm/java-6-openjdk-amd64/jre/../lib/amd64
HOME = /var/lib/jenkins
TERM = screen
HUDSON_HOME = /var/lib/jenkins
PATH = /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
Package Directory: /var/lib/jenkins/.julia/v0.4
No packages installed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment