title: Is there a performance gain from defining routes in app.yaml versus one large mapping in a WSGIApplication in AppEngine?
body: <h1>Scenario 1</h1>
  
  <p>This involves using one "gateway" route in <code>app.yaml</code> and then choosing the <code>RequestHandler</code> in the <code>WSGIApplication</code>.</p>
  
  <h2>app.yaml</h2>
  
  <pre><code>- url: /.*
    script: main.py
  </code></pre>
  
  <h2>main.py</h2>
  
  <pre><code>from google.appengine.ext import webapp
  
  class Page1(webapp.RequestHandler):
      def get(self):
          self.response.out.write("Page 1")
  
  class Page2(webapp.RequestHandler):
      def get(self):
          self.response.out.write("Page 2")
  
  application = webapp.WSGIApplication([
      ('/page1/', Page1),
      ('/page2/', Page2),
  ], debug=True)
  
  def main():
      wsgiref.handlers.CGIHandler().run(application)
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <hr>
  
  <h1>Scenario 2:</h1>
  
  <p>This involves defining two routes in <code>app.yaml</code> and then two separate scripts for each (<code>page1.py</code> and <code>page2.py</code>). </p>
  
  <h2>app.yaml</h2>
  
  <pre><code>- url: /page1/
    script: page1.py
  - url: /page2/
    script: page2.py
  </code></pre>
  
  <h2>page1.py</h2>
  
  <pre><code>from google.appengine.ext import webapp
  
  class Page1(webapp.RequestHandler):
      def get(self):
          self.response.out.write("Page 1")
  
  application = webapp.WSGIApplication([
      ('/page1/', Page1),
  ], debug=True)
  
  def main():
      wsgiref.handlers.CGIHandler().run(application)
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <h2>page2.py</h2>
  
  <pre><code>from google.appengine.ext import webapp
  
  class Page2(webapp.RequestHandler):
      def get(self):
          self.response.out.write("Page 2")
  
  application = webapp.WSGIApplication([
      ('/page2/', Page2),
  ], debug=True)
  
  def main():
      wsgiref.handlers.CGIHandler().run(application)
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <hr>
  
  <h1>Question</h1>
  
  <p>What are the benefits and drawbacks of each pattern? Is one much faster than the other?</p>