Closed giordano closed 2 years ago
how does a typed global compare? it's fairly unintuitive to me that this would make such a big difference.
diff --git a/src/leibniz.jl b/src/leibniz.jl
index 5967ebc..d602e53 100644
--- a/src/leibniz.jl
+++ b/src/leibniz.jl
@@ -10,5 +10,5 @@ function f(rounds)
return pi*4
end
-rounds = parse(Int64, readchomp(joinpath(@__DIR__, "rounds.txt")))
+rounds::Int = parse(Int, readchomp(joinpath(@__DIR__, "rounds.txt")))
print(f(rounds))
julia> @time f(rounds)
0.003839 seconds
3.1415916535917745
julia> @time f(rounds)
0.003866 seconds
3.1415916535917745
but this requires v1.8 necessarily.
Closing because this wasn't the bottleneck discussed in #13.
This makes the first run of the
f
function in Julia less awful. Before the PR (same as https://github.com/niklas-heer/speed-comparison/pull/13#issuecomment-1264752392):With this PR:
For the record: