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)