Thanks! On Tue, Nov 5, 2013 at 7:12 PM, Eric Wong wrote: > Eric Wong wrote: > > Eric Wong wrote: > > > James Tucker wrote: > > > > Yeah, Builder#call leads to mistakes all the time and then people > claiming > > > > performance sucks. I don't think the simple use case there ever > helped. > > > > > > Just curious, is this in test suites or code running on live servers? > > > I can't imagine there are many one-off webservers existing and using > > > that directly... > > > > Answering my own question, the "map" directive in Builder seems to > > trigger Builder#to_app in every single request. > > > > It looks like map completely defeats warmup and preloading... > > OK, I can't tell if my this has any bad side effects (specs pass!), > but I'm already running this on yhbt.net: > > From: Eric Wong > Date: Wed, 6 Nov 2013 03:02:48 +0000 > Subject: [PATCH] builder: avoid to_app on every request when using map > > By calling to_app immediately after initializing the per-map > Rack::Builder instances. Otherwise, benefits of warmup and web > servers taking advantage of CoW are lost. > > This passes tests, and is lightly tested and I have not verified > this for any negative consequences or incompatibilities. > --- > lib/rack/builder.rb | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/rack/builder.rb b/lib/rack/builder.rb > index fa3a1ea..2aa37b6 100644 > --- a/lib/rack/builder.rb > +++ b/lib/rack/builder.rb > @@ -157,7 +157,7 @@ module Rack > > def generate_map(default_app, mapping) > mapped = default_app ? {'/' => default_app} : {} > - mapping.each { |r,b| mapped[r] = self.class.new(default_app, &b) } > + mapping.each { |r,b| mapped[r] = self.class.new(default_app, > &b).to_app } > URLMap.new(mapped) > end > end > -- > The following changes since commit > df1506b0825a096514fcb3821563bf9e8fd52743: > > Merge pull request #617 from tmm1/builder-warmup (2013-10-25 21:10:40 > -0700) > > are available in the git repository at: > > git://git.bogomips.org/rack.git builder-map-to_app > > for you to fetch changes up to fd023bafed0ad97e08d15381f35600e3a5b32808: > > builder: avoid to_app on every request when using map (2013-11-06 > 03:08:38 +0000) > > ---------------------------------------------------------------- > Eric Wong (1): > builder: avoid to_app on every request when using map > > -- > > --- > You received this message because you are subscribed to the Google Groups > "Rack Development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rack-devel+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- --- You received this message because you are subscribed to the Google Groups "Rack Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout.