gabrielfalcao/HTTPretty — pull request #195 by jasonmartens (2014-10-29 19:02:50+00:00)
Title: Speed up last_requestline lookup of headers

When using HTTPretty with moto, I found the S3 tests were very slow. After profiling the code, I discovered a large amount of time was spent in last_requestline. This is because every chunk of data uploaded in an S3 multipart upload is added to self._sent_data, causing the list to get very long and with data that is not header data. This change keeps a cached list of just header data entries to improve the speed of this lookup. It is a bit of a hack, so feel free to do something more intelligent, but it did improve my unit test speed by 8x.