chansen/p5-http-tiny — pull request #30 by clintongormley (2013-10-04 19:00:37+00:00)
Title: Added support for persistent connections

I've followed the ideas in issue #14 and implemented persistent connections.Sockets are reused if:
* `keep_alive` is true
* the `host`, `port`, `scheme`, and `timeout` match the values of the previous connection
* the socket isn't dirty ( `$self->can_read == false`)
* the socket hasn't been closed

To give you an idea of what a difference it makes when using it to talk to Elasticsearch (HTTPTiny2 uses persistent connections):

Write:
s/iter HTTPTiny HTTPTiny2
HTTPTiny 1.77 -- -46%
HTTPTiny2 0.956 86% --

Read:
s/iter HTTPTiny HTTPTiny2
HTTPTiny 1.50 -- -43%
HTTPTiny2 0.856 75% --

I WANT this :)

The bit I'm missing is how to write the tests for it. Any pointers?