From: Derrick Stolee Date: Mon, 29 Nov 2021 17:37:13 GMT Subject: Re: [PATCH v3 5/5] unpack-objects: unpack_non_delta_entry() read data in a stream Message-ID: <8ff89e50-1b80-7932-f0e2-af401ee04bb1@gmail.com> In-Reply-To: <20211122033220.32883-6-chiyutianyi@gmail.com> On 11/21/2021 10:32 PM, Han Xin wrote: > From: Han Xin > > We used to call "get_data()" in "unpack_non_delta_entry()" to read the > entire contents of a blob object, no matter how big it is. This > implementation may consume all the memory and cause OOM. > > By implementing a zstream version of input_stream interface, we can use > a small fixed buffer for "unpack_non_delta_entry()". > > However, unpack non-delta objects from a stream instead of from an entrie > buffer will have 10% performance penalty. Therefore, only unpack object > larger than the "big_file_threshold" in zstream. See the following > benchmarks: > > $ hyperfine \ > --prepare 'rm -rf dest.git && git init --bare dest.git' \ > 'git -C dest.git unpack-objects Benchmark 1: git -C dest.git unpack-objects Time (mean ± σ): 10.029 s ± 0.270 s [User: 8.265 s, System: 1.522 s] > Range (min … max): 9.786 s … 10.603 s 10 runs > > $ hyperfine \ > --prepare 'rm -rf dest.git && git init --bare dest.git' \ > 'git -c core.bigFileThreshold=2m -C dest.git unpack-objects Benchmark 1: git -c core.bigFileThreshold=2m -C dest.git unpack-objects Time (mean ± σ): 10.859 s ± 0.774 s [User: 8.813 s, System: 1.898 s] > Range (min … max): 9.884 s … 12.192 s 10 runs It seems that you want us to compare this pair of results, and hyperfine can assist with that by including multiple benchmarks (with labels, using '-n') as follows: $ hyperfine \ --prepare 'rm -rf dest.git && git init --bare dest.git' \ -n 'old' '~/_git/git-upstream/git -C dest.git unpack-objects