Closed Thomasdezeeuw closed 7 years ago
I don't expect a performance boost. However most applications will likely only use a single compression level.
With this change pools will only be created for compression levels that are actually used. This should reduce the memory usage, albeit not by much.
I'm a bit concerned we're adding complexity to the library with very little benefit with this PR. Were you having memory or performance issues with this middleware that led to this change?
In the future, please provide some additional context when making a PR. For some ideas, take a look at our contributing guidelines: https://github.com/NYTimes/gziphandler/blob/master/CONTRIBUTING.md
I didn't have any problems with the package, however creating a pool for each compression level seemed unnecessary to me, hence the change.
It looks like we're just transferring the logic in the
init
block to the constructor function, which should happen at server startup anyways.Are you expecting some performance boost from this addition? Have you run the benchmarks?