-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
608aea9
commit 9fad884
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tune.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The benchmarks are recommended to be run using PkgBenchmark.jl as: | ||
|
||
``` | ||
using PkgBenchmark | ||
results = benchmarkpkg("JuliaInterpreter") | ||
``` | ||
|
||
See the [PkgBenchmark](https://juliaci.github.io/PkgBenchmark.jl/stable/index.html) documentation for what | ||
analysis is possible on `result`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using JuliaInterpreter | ||
using BenchmarkTools | ||
|
||
const SUITE = BenchmarkGroup() | ||
|
||
# Recursively call itself | ||
f(i, j) = i == 0 ? j : f(i - 1, j + 1) | ||
SUITE["recursive self 1_000"] = @benchmarkable @interpret f(1_000, 0) | ||
|
||
# Long stack trace calling other functions | ||
f0(i) = i | ||
for i in 1:1_000 | ||
@eval $(Symbol("f", i))(i) = $(Symbol("f", i-1))(i) | ||
end | ||
SUITE["recursive other 1_000"] = @benchmarkable @interpret f1000(1) | ||
|
||
# Tight loop | ||
function f(X) | ||
s = 0 | ||
for x in X | ||
s += x | ||
end | ||
return s | ||
end | ||
const X = rand(1:10, 10_000) | ||
SUITE["tight loop 10_000"] = @benchmarkable @interpret f(X) | ||
|
||
# Throwing and catching an error over a large stacktrace | ||
function g0(i) | ||
try | ||
g1(i) | ||
catch e | ||
e | ||
end | ||
end | ||
for i in 1:1_000 | ||
@eval $(Symbol("g", i))(i) = $(Symbol("g", i+1))(i) | ||
end | ||
g1001(i) = error() | ||
SUITE["throw long 1_000"] = @benchmarkable @interpret g0(1) | ||
|
||
# Function with many statements | ||
macro do_thing(expr, N) | ||
e = Expr(:block) | ||
for i in 1:N | ||
push!(e.args, esc(expr)) | ||
end | ||
return e | ||
end | ||
|
||
function counter() | ||
a = 0 | ||
@do_thing(a = a + 1, 5_000) | ||
return a | ||
end | ||
SUITE["long function 5_000"] = @benchmarkable @interpret counter() |