sapling/mercurial/hgweb
Gregory Szorc 312f42b6e4 hgweb: tweak zlib chunking behavior
When doing streaming compression with zlib, zlib appears to emit chunks
with data after ~20-30kb on average is available. In other words, most
calls to compress() return an empty string. On the mozilla-unified repo,
only 48,433 of 921,167 (5.26%) of calls to compress() returned data.
In other words, we were sending hundreds of thousands of empty chunks
via a generator where they touched who knows how many frames (my guess
is millions). Filtering out the empty chunks from the generator
cuts down on overhead.

In addition, we were previously feeding 8kb chunks into zlib
compression. Since this function tends to emit *compressed* data after
20-30kb is available, it would take several calls before data was
produced. We increase the amount of data fed in at a time to 32kb.
This reduces the number of calls to compress() from 921,167 to
115,146. It also reduces the number of output chunks from 48,433 to
31,377. This does increase the average output chunk size by a little.
But I don't think this will matter in most scenarios.

The combination of these 2 changes appears to shave ~6s CPU time
or ~3% from a server serving the mozilla-unified repo.
2016-08-14 21:29:46 -07:00
..
__init__.py hgweb: make sure command options are set to all ui objects 2015-11-21 13:28:12 +09:00
common.py py3: conditionalize BaseHTTPServer, SimpleHTTPServer and CGIHTTPServer import 2016-07-13 23:38:29 +05:30
hgweb_mod.py hgweb: profile HTTP requests 2016-08-14 18:37:24 -07:00
hgwebdir_mod.py hgweb: profile HTTP requests 2016-08-14 18:37:24 -07:00
protocol.py hgweb: tweak zlib chunking behavior 2016-08-14 21:29:46 -07:00
request.py hgweb: use absolute_import 2015-10-31 22:07:40 +09:00
server.py py3: conditionalize BaseHTTPServer, SimpleHTTPServer and CGIHTTPServer import 2016-07-13 23:38:29 +05:30
webcommands.py paper: make different blocks of annotated lines have different colors 2016-07-16 14:49:07 +08:00
webutil.py py3: convert to next() function 2016-05-16 21:30:53 +00:00
wsgicgi.py hgweb: use absolute_import 2015-10-31 22:07:40 +09:00