From 8b81bcc67c7ce963f7a26ce7860207c3e423f884 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Wed, 6 Feb 2013 12:53:52 -0500 Subject: [PATCH] Bug 837715. Reduce compression rate for js source. r=benjamin This cuts the time to compress gaia-email-opt.js from 0.63 seconds to 0.33 seconds. The result should still be smaller (391K from 321K before) than the compressing with snappy or lz4 (528K), but decompression time will be worse. Fortunately, this will only penalize Function.toSource() which I think is an ok trade off. --HG-- extra : rebase_source : 00c9e38fa2099ed03dc24aea9582f48423fe3a1b --- js/src/jsutil.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/src/jsutil.cpp b/js/src/jsutil.cpp index 6c1ef12de43c..d284907c1b84 100644 --- a/js/src/jsutil.cpp +++ b/js/src/jsutil.cpp @@ -73,7 +73,10 @@ Compressor::init() { if (inplen >= UINT32_MAX) return false; - int ret = deflateInit(&zs, Z_DEFAULT_COMPRESSION); + // zlib is slow and we'd rather be done compression sooner + // even if it means decompression is slower which penalizes + // Function.toString() + int ret = deflateInit(&zs, Z_BEST_SPEED); if (ret != Z_OK) { JS_ASSERT(ret == Z_MEM_ERROR); return false;