Skip to content

Instantly share code, notes, and snippets.

@vfulco
Forked from johnmyleswhite/costly_bigints.jl
Created June 14, 2013 12:30
Show Gist options
  • Save vfulco/5781442 to your computer and use it in GitHub Desktop.
Save vfulco/5781442 to your computer and use it in GitHub Desktop.
function foo(n::Integer)
x::Int = 0
t1::Float64 = @elapsed for i in 1:n
x = x + 1
end
@printf "Int: %f\n" t1
y::BigInt = BigInt(0)
t2::Float64 = @elapsed for i in 1:n
y = y + BigInt(1)
end
@printf "BigInt: %f\n" t2
end
foo(100_000_000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment