]> git.ipfire.org Git - pakfire.git/commitdiff
archive: Increase the block size
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 12 Jan 2025 11:27:23 +0000 (11:27 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 12 Jan 2025 11:27:23 +0000 (11:27 +0000)
This will use a little bit more memory per opened archive, but will make
extraction somewhat faster. Extracting the snapshot shrinks from about
25 to 23 seconds on my system.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/archive.c

index f7822c24e831e9a36047d2666231762adbedea8e..51e877bbcbc2d359c679d4677460b06bf501a65f 100644 (file)
@@ -58,6 +58,8 @@
 // The maximum number of symlinks to follow when reading a file from an archive
 #define MAX_FOLLOW_SYMLINKS 10
 
+#define ARCHIVE_READ_BLOCK_SIZE 512 * 1024
+
 struct pakfire_archive {
        struct pakfire_ctx* ctx;
        struct pakfire* pakfire;
@@ -93,7 +95,7 @@ struct pakfire_archive_file {
        FILE* f;
 
        // Buffer to store a block of data
-       char buffer[128 * 1024];
+       char buffer[ARCHIVE_READ_BLOCK_SIZE];
 
        enum {
                PAKFIRE_ARCHIVE_FILE_CANT_SEEK = (1 << 0),