Mon, 05 Oct 2015 17:36:32 -0700 util.chunkbuffer: avoid extra mutations when reading partial chunks
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 05 Oct 2015 17:36:32 -0700] rev 26480
util.chunkbuffer: avoid extra mutations when reading partial chunks Previously, a read(N) where N was less than the length of the first available chunk would mutate the deque instance twice and allocate a new str from the slice of the existing chunk. Profiling drawed my attention to these as a potential hot spot during changegroup reading. This patch makes the code more complicated in order to avoid the aforementioned 3 operations. On a pre-generated mozilla-central gzip bundle, this series has the following impact on `hg unbundle` performance on my MacBook Pro: before: 358.21 real 317.69 user 38.49 sys after: 301.57 real 262.69 user 37.11 sys delta: -56.64 real -55.00 user -1.38 sys
Mon, 05 Oct 2015 16:34:47 -0700 util.chunkbuffer: refactor chunk handling logic
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 05 Oct 2015 16:34:47 -0700] rev 26479
util.chunkbuffer: refactor chunk handling logic This will make the next patch easier to read. It provides no benefit on its own.
Mon, 05 Oct 2015 16:28:12 -0700 util.chunkbuffer: special case reading everything
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 05 Oct 2015 16:28:12 -0700] rev 26478
util.chunkbuffer: special case reading everything The new code results in simpler logic within the while loop. It is also faster since we avoid performing operations on the queue and buf collections. However, there shouldn't be any super hot loops for this since the whole point of chunkbuffer is to avoid reading large amounts of data at once. This does, however, make it easier to optimize chunkbuffer in a subsequent patch.
(0) -10000 -3000 -1000 -300 -100 -30 -10 -3 +3 +10 +30 +100 +300 +1000 +3000 +10000 tip