Permalink
Browse files

Added simple Sinatra benchmark

  • Loading branch information...
1 parent 52cc73a commit 66c21c6a0604c846ada5f893c5ea337c0392e441 @hosiawak hosiawak committed Feb 28, 2013
Showing with 40 additions and 0 deletions.
  1. +40 −0 benchmark/web/sinatra/bench_hello_world.rb
@@ -0,0 +1,40 @@
+require 'benchmark'
+require 'benchmark/ips'
+
+require 'rubygems'
+require 'rubygems/commands/install_command'
+
+SINATRA_VERSION = '1.3.5'
+
+begin
+ gem 'sinatra', SINATRA_VERSION
+ require 'sinatra'
+rescue LoadError
+ inst = Gem::DependencyInstaller.new
+ inst.install 'sinatra', SINATRA_VERSION
+ gem 'sinatra', SINATRA_VERSION
+ require 'sinatra'
+end
+
+module Sinatra
+ class Application < Base
+ def self.run?
+ false
+ end
+ end
+end
+
+class MyApp < Sinatra::Base
+
+ get '/hello' do
+ "Hello world"
+ end
+end
+
+Benchmark.ips do |x|
+ x.report "Sinatra hello world" do
+ MyApp.call({"PATH_INFO" => "/hello", "REQUEST_METHOD" => "GET", "rack.input" => ""})
+ end
+
+end
+

0 comments on commit 66c21c6

Please sign in to comment.