cabal upload: use ByteString instead of String#1614
Merged
Conversation
The difference is seen nicely on Raincat package (9MB tarball):
$ /usr/bin/time cabal upload --check Raincat-1.1.1.3.tar.gz
39.92user
0.38system
4:02.50elapsed
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-1.1.1.3.tar.gz
0.25user
0.16system
4:28.61elapsed
0%CPU (0avgtext+0avgdata 66864maxresident)k
In short: 1.8GB -> 66MB RAM reduction + 16% -> 0% CPU usage.
Reported-by: "Mikhail S. Pobolovets" <styx.mp@gmail.com>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Member
|
LGTM. |
Member
|
LGTM |
|
👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The difference is seen nicely on Raincat package (9MB tarball):
$ /usr/bin/time cabal upload --check Raincat-1.1.1.3.tar.gz
39.92user
0.38system
4:02.50elapsed
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:
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-1.1.1.3.tar.gz
In short: 1.8GB -> 66MB RAM reduction + 16% -> 0% CPU usage.
Reported-by: "Mikhail S. Pobolovets" styx.mp@gmail.com
Signed-off-by: Sergei Trofimovich slyfox@gentoo.org