-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change C++ singlejar to use stdio for all output, instead of a mix of
sendfile() and write() without buffering. sendfile() is not a speedup for typical jar contents; the average compressed class file is less than 2KB, so memcpy()ing the data into a large buffer is cheaper than the extra system calls. The existing non-sendfile code was making four calls to lseek() per archive member. I removed all of those by using pread() or caching the output position. Configure stdio to use a 128KB buffer to make fewer write() calls to the output file. This is a noticeable speedup over the default when writing to a fuse filesystem. (I think this wouldn't be necessary if our fuse filesystems would set st_blksize appropriately in stat() results.) Remove needless thread-hostile calls to umask(). -- MOS_MIGRATED_REVID=133057985
- Loading branch information
Showing
2 changed files
with
65 additions
and
91 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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