some worries about the performance? #529

Closed
dahakawang opened this Issue Mar 19, 2013 · 2 comments

3 participants

@dahakawang

hello everyone,
im new to rack, and found it amazing to be such a simple and easy to use library.

recently iv looked in to its code, and find following:

    def to_app
      app = @map ? generate_map(@run, @map) : @run
      fail "missing run or map statement" unless app
      @use.reverse.inject(app) { |a,e| e[a] }
    end

    def call(env)
      to_app.call(env)
    end

it seems every time when a new http request arrives the Rack will recreate the middleware stack, what i worry about is if it will have a bad impact on performance? is the recreation necessary?

@rkh
Official Rack repositories member

I have never run into a case where I was using a Rack::Builder instance as endpoint.

@raggi
Official Rack repositories member

You are supposed to use the result of to_app as your app.

@raggi raggi closed this Apr 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment