-
Notifications
You must be signed in to change notification settings - Fork 191
/
Copy pathpolybench.rb
36 lines (28 loc) · 1.07 KB
/
polybench.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. This
# code is released under a tri EPL/GPL/LGPL license. You can use it,
# redistribute it and/or modify it under the terms of the:
#
# Eclipse Public License version 2.0, or
# GNU General Public License version 2, or
# GNU Lesser General Public License version 2.1.
# A small subset of PolyBenchLauncher (in the /vm suite)
# to make it easier to run on an already-built GraalVM or other Ruby.
# Use it like:
# jt -u CONFIG ruby --experimental-options --engine.Compilation=false bench/polybench.rb ../graal/vm/benchmarks/interpreter/richards.rb
require 'benchmark'
benchmark = File.expand_path(ARGV.fetch(0))
BASENAME = File.basename(benchmark)
require benchmark
WARMUP_ITERATIONS = 20
MEASURE_ITERATIONS = 30
def repeat_iterations(iterations)
iterations.times { |i|
t = Benchmark.realtime { run() }
puts "[#{BASENAME}] iteration #{i}: #{'%.2f' % (t * 1000)} ms"
}
end
puts '::: Running warmup :::'
repeat_iterations(WARMUP_ITERATIONS)
puts
puts '::: Running :::'
repeat_iterations(MEASURE_ITERATIONS)