Skip to content
Browse files

Added simple rack benchmark

  • Loading branch information...
1 parent cf586b6 commit 52cc73ae31a14f6950e90fec173c20bfea27e8ea @hosiawak hosiawak committed
Showing with 31 additions and 0 deletions.
  1. +31 −0 benchmark/web/rack/bench_hello_world.rb
View
31 benchmark/web/rack/bench_hello_world.rb
@@ -0,0 +1,31 @@
+require 'benchmark'
+require 'benchmark/ips'
+
+class HelloWorld
+ def call(env)
+ [200, {"Content-Type" => "text/html"}, "Hello world"]
+ end
+end
+
+class RackHandler
+
+ def initialize(app)
+ @app = app
+ end
+
+ def process
+ @app.call({})
+ end
+
+end
+
+Benchmark.ips do |x|
+
+ handler = RackHandler.new(HelloWorld.new)
+
+ x.report 'Rack hello world' do
+ handler.process
+ end
+
+end
+

0 comments on commit 52cc73a

Please sign in to comment.
Something went wrong with that request. Please try again.