yonran/git.js — comment on commit 7966d1e303500a061ab3e842a5dcf8d94153b0ed
File: lib/git/zlib.js line 8
By yonran:

Agreed. However, the severe performance problem I encountered was that
we were sending the entire rest of the pack to the Worker because in
.pack files you don't know a priori how big the compressed size of the
object is. I saw two immediate solutions:

1. When reading the .idx file, sort by offsets and hold it in memory,
and then binary search it (in UI thread) to get the next offset, so
you know compressed size of the object. Then send compressed data to a
Worker to run zlib.
2. Fix deflate so that you don't have to copy the pack file, but then
zlib has to run in UI thread for now.

But I think 2 is more permanent because maybe we don't want to keep
inverted .idx in memory.

I want to do zlib in a Worker; I just think we need to move a
different function to it (perhaps everything from HttpRemote down?) to
avoid copying so much data.