File tree Expand file tree Collapse file tree 3 files changed +66
-0
lines changed Expand file tree Collapse file tree 3 files changed +66
-0
lines changed Original file line number Diff line number Diff line change
1
+ tune.json
Original file line number Diff line number Diff line change
1
+ The benchmarks are recommended to be run using PkgBenchmark.jl as:
2
+
3
+ ```
4
+ using PkgBenchmark
5
+ results = benchmarkpkg("JuliaInterpreter")
6
+ ```
7
+
8
+ See the [ PkgBenchmark] ( https://juliaci.github.io/PkgBenchmark.jl/stable/index.html ) documentation for what
9
+ analysis is possible on ` result ` .
Original file line number Diff line number Diff line change
1
+ using JuliaInterpreter
2
+ using BenchmarkTools
3
+
4
+ const SUITE = BenchmarkGroup ()
5
+
6
+ # Recursively call itself
7
+ f (i, j) = i == 0 ? j : f (i - 1 , j + 1 )
8
+ SUITE[" recursive self 1_000" ] = @benchmarkable @interpret f (1_000 , 0 )
9
+
10
+ # Long stack trace calling other functions
11
+ f0 (i) = i
12
+ for i in 1 : 1_000
13
+ @eval $ (Symbol (" f" , i))(i) = $ (Symbol (" f" , i- 1 ))(i)
14
+ end
15
+ SUITE[" recursive other 1_000" ] = @benchmarkable @interpret f1000 (1 )
16
+
17
+ # Tight loop
18
+ function f (X)
19
+ s = 0
20
+ for x in X
21
+ s += x
22
+ end
23
+ return s
24
+ end
25
+ const X = rand (1 : 10 , 10_000 )
26
+ SUITE[" tight loop 10_000" ] = @benchmarkable @interpret f (X)
27
+
28
+ # Throwing and catching an error over a large stacktrace
29
+ function g0 (i)
30
+ try
31
+ g1 (i)
32
+ catch e
33
+ e
34
+ end
35
+ end
36
+ for i in 1 : 1_000
37
+ @eval $ (Symbol (" g" , i))(i) = $ (Symbol (" g" , i+ 1 ))(i)
38
+ end
39
+ g1001 (i) = error ()
40
+ SUITE[" throw long 1_000" ] = @benchmarkable @interpret g0 (1 )
41
+
42
+ # Function with many statements
43
+ macro do_thing (expr, N)
44
+ e = Expr (:block )
45
+ for i in 1 : N
46
+ push! (e. args, esc (expr))
47
+ end
48
+ return e
49
+ end
50
+
51
+ function counter ()
52
+ a = 0
53
+ @do_thing (a = a + 1 , 5_000 )
54
+ return a
55
+ end
56
+ SUITE[" long function 5_000" ] = @benchmarkable @interpret counter ()
You can’t perform that action at this time.
0 commit comments