Permalink
Browse files

Add a bench for ruby executable invocation

  • Loading branch information...
1 parent 8732fc6 commit ae504c6f5371d74b5a190099ea9e327c9a3baab8 @dbussink dbussink committed with ryoqun May 22, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 benchmark/real_world/bench_startup.rb
@@ -0,0 +1,17 @@
+require 'benchmark'
+require 'benchmark/ips'
+require 'rbconfig'
+
+Benchmark.ips(30) do |x|
+ ruby = RbConfig::CONFIG["RUBY_INSTALL_NAME"] || RbConfig::CONFIG["ruby_install_name"]
+ ruby << (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '')
+ ruby = File.join(RbConfig::CONFIG['bindir'], ruby)
+
+ x.report "startup" do |times|
+ i = 0
+ while i < times
+ `#{ruby} -e ''`
+ i += 1
+ end
+ end
+end

1 comment on commit ae504c6

@jc00ke
Member
jc00ke commented on ae504c6 May 23, 2012

Does this into take into account the time it takes to shell out via backticks?

Please sign in to comment.