mperham/connection_pool — pull request #30 by dalyons (2013-04-04 16:37:23+00:00)
Title: Method cache

So I recently wanted to use the wrapper pool, for external interface preservation reasons.
Saw your warning about method_missing, so I added some code to dynamically define the proxy methods to the connection pool objects on the fly, a la ActiveRecord's old finder methods.
Now you pay the price only once per unique method calls, after that the method is 'cached'.

That said, after I finished & tested the change, I benched it. On my 1.9.3 install, it really dosent make much difference, because the `method_missing` code wasn't much slower than the `with` to begin with(100000 calls):

wrapper: 12.440000 0.060000 12.500000 ( 12.511956)
cached_wrapper: 12.120000 0.050000 12.170000 ( 12.180331)
with: 11.880000 0.050000 11.930000 ( 11.977355)

I suspect its pretty quick anyway because the dispatch chain to method_missing from BasicObject is really short.

So, I don't know, its up to you whether you think this patch is worth it or not.