Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func main() {
repeatedByte1Estimator,
repeatedByte2Estimator,
repeatedOrZeroEstimator,
fastLZWithUpperBoundEstimator,
fastLZEstimator,
zlibBestEstimator,
zlibBestBatchEstimator, // final estimator value is always used as the "ground truth" against which others are measured
Expand Down Expand Up @@ -470,6 +471,14 @@ func fastLZEstimator(tx []byte) float64 {
return float64(flzCompressLen(tx))
}

func fastLZWithUpperBoundEstimator(tx []byte) float64 {
fastLZSize := fastLZEstimator(tx)
if fastLZSize > float64(len(tx)) {
return float64(len(tx))
}
return fastLZSize
}

// uncompressedSizeEstimator just returns the length of the input
func uncompressedSizeEstimator(tx []byte) float64 {
return float64(len(tx))
Expand Down