The difference is seen nicely on Raincat package (9MB tarball):
$ /usr/bin/time cabal upload --check Raincat-126.96.36.199.tar.gz
16%CPU (0avgtext+0avgdata 1855712maxresident)k
Insane amounts of used RAM (1.8GB) seem to stem from 'String'
inefficiency especially on 64-bit platforms where overhead is
about 16 times:
- 97% of CPU time is taken by GC scans (according to +RTS -sstderr)
- 9MB tarball would take ~150MBs of RAM, 100MB tarball would...
Attempt to pack them into HTTP headers leads to further growth.
The patch only changes underlying structure to ByteString.Lazy.Char8:
$ /usr/bin/time patched-cabal upload --check Raincat-188.8.131.52.tar.gz
0%CPU (0avgtext+0avgdata 66864maxresident)k
In short: 1.8GB -> 66MB RAM reduction + 16% -> 0% CPU usage.
Reported-by: "Mikhail S. Pobolovets" <firstname.lastname@example.org>
Signed-off-by: Sergei Trofimovich <email@example.com>