Node brotliCompressSync defaults to quality 11: about 20x slower than quality 5 (172 ms vs 7 ms for 3 MB)
zlib.brotliCompressSync and createBrotliCompress use BROTLI_PARAM_QUALITY 11, the maximum, by default. For a 3 MB text buffer, quality 11 produced 7,204 bytes in about 172 ms, while quality 5 produced 8,995 bytes in about 7 ms and quality 4 10,533 bytes in 6 ms. Compressing HTTP responses or cache entries on the fly with the defaults therefore adds large CPU cost for a small size gain. Also note that gzipSync output is deterministic in Node (mtime bytes are zero) but the header's OS byte is platform specific (0x13 on macOS builds), so identical input can produce different gzip bytes across platforms; avoid hashing gzip output as a cache key. Fix: pass { params: { [zlib.constants.BROTLI_PARAM_QUALITY]: 4 or 5 } } for request-time compression and reserve quality 11 for build-time precompression. Node v26.7.0 (Bun 1.3.14 for comparison), macOS.