File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ # A fixed-workload harness for OptCarrot with minimal dependencies.
2
+ # This can be useful to debug or tune performance.
3
+ #
4
+ # Run with:
5
+ # jt build --graal
6
+ # jt ruby bench/optcarrot/fixed-workload.rb
7
+
8
+ require_relative 'lib/optcarrot'
9
+ require 'benchmark'
10
+
11
+ number_of_iterations = 5000
12
+
13
+ rom = File . expand_path ( '../examples/Lan_Master.nes' , __FILE__ )
14
+ nes = Optcarrot ::NES . new [ '--headless' , rom ]
15
+ nes . reset
16
+
17
+ total = Benchmark . realtime do
18
+ number_of_iterations . times do
19
+ t = Benchmark . realtime { nes . step }
20
+ Truffle ::Debug . print 1 /t
21
+ end
22
+ end
23
+
24
+ Truffle ::Debug . print "Total: #{ total } "
Original file line number Diff line number Diff line change @@ -17,6 +17,18 @@ $ jt benchmark bench/classic/mandelbrot.rb --simple
17
17
Output is iterations per second, printed roughly every second (more frequently
18
18
for the first few iterations).
19
19
20
+ ## OptCarrot
21
+
22
+ OptCarrot can be run the same way as the example above (with ` bench/optcarrot/optcarrot.rb ` ),
23
+ but also has a fixed-workload harness with minimal dependencies,
24
+ which can be useful to debug or tune performance.
25
+
26
+ Run the fixed-workload harness with minimal dependencies with:
27
+
28
+ ``` bash
29
+ $ jt ruby bench/optcarrot/fixed-workload.rb
30
+ ```
31
+
20
32
# Benchmarking without the GraalVM Compiler
21
33
22
34
You can turn off the GraalVM Compiler if you want, by not including it in the GraalVM build:
You can’t perform that action at this time.
0 commit comments