When running repetitive requests (tremendous amounts of repetitive requests in fact), you might want to skip charset detection and header parsing for performance. That is very difficult to do if the class lookup for Response happens at the C level. Therefore, it might be a good idea to use dynamic lookup to figure out the response class. If you subclass Session and override the response_class you can then use an optimised version of a Response that, for instance, quickly grabs the status code that you got and moves on.
Adds one method call per request-response cycle and one stack cruby ref, so should be gentle performance-wise.
When running repetitive requests (tremendous amounts of repetitive requests in fact), you might want to skip charset detection and header parsing for performance. That is very difficult to do if the class lookup for Response happens at the C level. Therefore, it might be a good idea to use dynamic lookup to figure out the response class. If you subclass Session and override the
response_class
you can then use an optimised version of a Response that, for instance, quickly grabs the status code that you got and moves on.Adds one method call per request-response cycle and one stack cruby ref, so should be gentle performance-wise.