diff --git a/common/files.go b/common/files.go index 187fcc95..d2fbdeb4 100644 --- a/common/files.go +++ b/common/files.go @@ -238,6 +238,15 @@ func (list SFileList) JSTmplInit() error { if err != nil { return err } + // Don't use Gzip if we get meagre gains from it as it takes longer to process the responses + if len(gzipData) >= (len(data) + 150) { + gzipData = nil + } else { + diff := len(data) - len(gzipData) + if diff <= len(data)/100 { + gzipData = nil + } + } // Get a checksum for CSPs and cache busting hasher := sha256.New() @@ -279,7 +288,7 @@ func (list SFileList) Init() error { return err } // Don't use Gzip if we get meagre gains from it as it takes longer to process the responses - if len(gzipData) >= (len(data) + 100) { + if len(gzipData) >= (len(data) + 150) { gzipData = nil } else { diff := len(data) - len(gzipData) @@ -316,6 +325,15 @@ func (list SFileList) Add(path, prefix string) error { if err != nil { return err } + // Don't use Gzip if we get meagre gains from it as it takes longer to process the responses + if len(gzipData) >= (len(data) + 150) { + gzipData = nil + } else { + diff := len(data) - len(gzipData) + if diff <= len(data)/100 { + gzipData = nil + } + } // Get a checksum for CSPs and cache busting hasher := sha256.New() diff --git a/common/theme.go b/common/theme.go index c170a6f3..c7937903 100644 --- a/common/theme.go +++ b/common/theme.go @@ -161,6 +161,15 @@ func (t *Theme) AddThemeStaticFiles() error { if err != nil { return err } + // Don't use Gzip if we get meagre gains from it as it takes longer to process the responses + if len(gzipData) >= (len(data) + 150) { + gzipData = nil + } else { + diff := len(data) - len(gzipData) + if diff <= len(data)/100 { + gzipData = nil + } + } // Get a checksum for CSPs and cache busting hasher := sha256.New()