mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 08:41:15 +00:00
xzcat: Use BufferedFile for reading inputs
This improves the decompression time of `clang-15.0.7.src.tar.xz` from 41 seconds down to about 5 seconds. The reason for this very significant improvement is that LZMA, the underlying compression of XZ, fills its range decompressor one byte at a time, causing a lot of overhead at the syscall barrier.
This commit is contained in:
parent
7000ccf89f
commit
3ec513ecf2
Notes:
sideshowbarker
2024-07-17 07:09:53 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/3ec513ecf2 Pull-request: https://github.com/SerenityOS/serenity/pull/18180 Reviewed-by: https://github.com/gmta Reviewed-by: https://github.com/trflynn89 ✅
|
@ -22,7 +22,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.parse(arguments);
|
||||
|
||||
auto file = TRY(Core::File::open_file_or_standard_stream(filename, Core::File::OpenMode::Read));
|
||||
auto stream = TRY(Compress::XzDecompressor::create(move(file)));
|
||||
auto buffered_file = TRY(Core::BufferedFile::create(move(file)));
|
||||
auto stream = TRY(Compress::XzDecompressor::create(move(buffered_file)));
|
||||
|
||||
// Arbitrarily chosen buffer size.
|
||||
Array<u8, 4096> buffer;
|
||||
|
|
Loading…
Reference in a new issue