oesmith / puffing-billy

A rewriting web proxy for testing interactions between your browser and external sites. Works with ruby + rspec.
MIT License
659 stars 170 forks source link

Only calculate cache scope and key if request is cacheable for performance #324

Closed nicedawg closed 2 years ago

nicedawg commented 2 years ago

While debugging general performance/reliability issues in our test suite, I thought I would see what effect disabling Billy's cache had on our test suite. (We don't intentionally use it.)

So I configured with cache = false, but was still surprised to see log entries about calculated cache keys for requests.

It appears ProxyHandler was unconditionally calculating the scope and key, the latter of which seems expensive to perform.

Admittedly, my understanding of the overall system is minimal, but it seems like this change wouldn't have any unwanted side effects, and skip unused method calls for users who have cache = false.

ronwsmith commented 2 years ago

thanks for the contribution @nicedawg ! I'll try to get this in soon.

ronwsmith commented 2 years ago

Released in v3.0.3