summaryrefslogtreecommitdiffhomepage
path: root/tasks
diff options
context:
space:
mode:
authordearblue <[email protected]>2020-08-04 21:54:47 +0900
committerdearblue <[email protected]>2020-08-04 22:04:05 +0900
commitfde95a7db59c84971252831d9ebfa1ce79d134af (patch)
treee603bd4bc49c200dcca038b65a043299829446e1 /tasks
parentcfb799a18e5adf8166e7ec72e2066da38062df1b (diff)
downloadmruby-fde95a7db59c84971252831d9ebfa1ce79d134af.tar.gz
mruby-fde95a7db59c84971252831d9ebfa1ce79d134af.zip
Improve `rake benchmark`
- Use POSIX format instead of GNU extension for `time` command. For example FreeBSD's `time(1)` does not have GNU extensions available. - Sort `benchmark/bm_*.rb`. This is because the order of the bar graph cannot be uniquely determined depending on the result of `Dir.glob`.
Diffstat (limited to 'tasks')
-rw-r--r--tasks/benchmark.rake6
1 files changed, 3 insertions, 3 deletions
diff --git a/tasks/benchmark.rake b/tasks/benchmark.rake
index 84e69ebee..6352f5c17 100644
--- a/tasks/benchmark.rake
+++ b/tasks/benchmark.rake
@@ -5,7 +5,7 @@ end
$dat_files = []
def bm_files
- Dir.glob("#{MRUBY_ROOT}/benchmark/bm_*.rb")
+ Dir.glob("#{MRUBY_ROOT}/benchmark/bm_*.rb").sort
end
def build_config_name
@@ -67,8 +67,8 @@ MRuby.each_target do |target|
puts "..."
data = (0...MRuby::BENCHMARK_REPEAT).map do |n|
- str = %x{(time -f "%e %S %U" #{mruby_bin} #{bm_file}) 2>&1 >/dev/null}
- str.split(' ').map(&:to_f)
+ str = %x{(time -p #{mruby_bin} #{bm_file}) 2>&1 >/dev/null}
+ str.scan(/\d+\.\d+$/).map(&:to_f) # [real, user, sys]
end
File.open(task.name, "w") do |f|