Skip to content

Commit

Permalink
[RUM-253] increase a bit the estimated deflate ratio + add justification
Browse files Browse the repository at this point in the history
  • Loading branch information
BenoitZugmeyer committed Oct 30, 2023
1 parent 8bbf305 commit ebb9a24
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/rum/src/domain/deflate/deflateEncoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ export function createDeflateEncoder(
},

estimateEncodedBytesCount(data) {
return data.length / 7
// This is a rough estimation of the data size once it'll be encoded by deflate. We observed
// that if it's the first chunk of data pushed to the stream, the ratio is lower (3-4), but
// after that the ratio is greater (10+). We chose 8 here, which (on average) seems to produce
// requests of the expected size.
return data.length / 8
},

stop() {
Expand Down

0 comments on commit ebb9a24

Please sign in to comment.