Skip to content

Instantly share code, notes, and snippets.

@julialang-jenkins
Created December 22, 2014 02:06
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 julialang-jenkins/bf49a0d48974a65a003b to your computer and use it in GitHub Desktop.
Save julialang-jenkins/bf49a0d48974a65a003b to your computer and use it in GitHub Desktop.
col test
elapsed time: 0.004460344 seconds (245720 bytes allocated)
elapsed time: 0.003603252 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.3.3
Commit b24213b (2014-11-23 20:19 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 (69.33984375 MB free)
Uptime: 2.462893e6 sec
Load Avg: 0.150390625 0.046875 0.05517578125
Intel Xeon E312xx (Sandy Bridge):
speed user nice sys idle irq
#1 2499 MHz 8487027 s 4690 s 1901708 s 234493053 s 468 s
#2 2499 MHz 7127917 s 221 s 1854561 s 236684301 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.3
No packages installed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment