を使用して「Hello World」アプリを作成し、その上Goliath
にマウントすることにしました。Grape
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
Bundler.setup :default
require 'goliath'
require 'grape' # <-- Comment out this line will hugely increase performance, but why?
class Server < Goliath::API
def response(env)
[200, {}, 'Hello, world!']
end
end
私はそれをベンチマークしました:
ab -n 1000 -c 100 http://localhost:9000/
1秒間に約250件のリクエストを処理できることを示しています。しかし、行をコメントアウトすると、この値は突然約 700 に増加しました。なぜ単純なものがこれほど大きな違いをもたらすことができるrequire 'grape'
のか、誰か答えられますか?require
PS私はMRI 2.2.2を使用しています