perlbal/Perlbal — pull request #13 by jasonbstubbs (2012-02-04 11:30:44+00:00)
Title: Various cleanups and speedups for the Vhosts plugin

There's a few changes here but each change is in a separate commit.. Other than one pure cleanup commit, the others are as follows (copied from CHANGELOG):

* Do vhost twiddling after all host header cleanups in order to standardize with regular vhost configuration.
* Fix handling of a www.exammple.com.:80 type host header in the vhost plugin.
* Don't check for a vhost twiddle request_uri if twiddling hasn't been configured, so that /__using/... uris aren't needlessly appropriated.
* Return an error rather than silently continuing when a vhost maps to a service that doesn't exist.
* Decrease overall CPU usage by 20% when using the vhost plugin.
* Allow vhost mappings to be deleted via the management port.

I'm not a perl programmer but even I know the vhost_selector optimization isn't very perl. Turning the closure into a static function was a lot faster (probably around 15%) but taking out the function call altogether is faster again. Yes, I could probably use a do { } while (0); and break out of it if need be, but I think gotos are more legible in this case... Just pre-empting the "WTF?!" ;)

Everything else should be pretty straight forward.