Browse files

Add 'see also' regarding zlib tradeoffs

  • Loading branch information...
1 parent 9da7f51 commit ec495a9bc298faf107b5582de9769f5e735890f2 @isaacs committed Oct 14, 2011
Showing with 13 additions and 1 deletion.
  1. +13 −1 doc/api/zlib.markdown
@@ -28,7 +28,9 @@ header on responses.
**Note: these examples are drastically simplified to show
the basic concept.** Zlib encoding can be expensive, and the results
-ought to be cached.
+ought to be cached. See <a href="#memory_Usage_Tuning">Memory Usage
+Tuning</a> below for more information on the speed/memory/compression
+tradeoffs involved in zlib usage.
// client request example
var zlib = require('zlib');
@@ -161,3 +163,13 @@ for small objects.
This is in addition to a single internal output slab buffer of size
`chunkSize`, which defaults to 16K.
+The speed of zlib compression is affected most dramatically by the
+`level` setting. A higher level will result in better compression, but
+will take longer to complete. A lower level will result in less
+compression, but will be much faster.
+In general, greater memory usage options will mean that node has to make
+fewer calls to zlib, since it'll be able to process more data in a
+single `write` operation. So, this is another factor that affects the
+speed, at the cost of memory usage.

0 comments on commit ec495a9

Please sign in to comment.