[PATCH] make ar faster
Oleg Tolmatcev
oleg.tolmatcev@gmail.com
Thu Apr 27 23:35:20 GMT 2023
Hello all,
this patch makes ar faster by increasing the buffer size from 8 KB to 8 MB.
---
bfd/archive.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/bfd/archive.c b/bfd/archive.c
index 4cc2f7c9..d179bcd3 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -2209,11 +2209,14 @@ _bfd_write_archive_contents (bfd *arch)
}
}
+ char *buffer = bfd_malloc (DEFAULT_BUFFERSIZE * 1024);
+ if (buffer == NULL)
+ return false;
+
for (current = arch->archive_head;
current != NULL;
current = current->archive_next)
{
- char buffer[DEFAULT_BUFFERSIZE];
bfd_size_type remaining = arelt_size (current);
/* Write ar header. */
@@ -2226,7 +2229,7 @@ _bfd_write_archive_contents (bfd *arch)
while (remaining)
{
- size_t amt = DEFAULT_BUFFERSIZE;
+ size_t amt = DEFAULT_BUFFERSIZE * 1024;
if (amt > remaining)
amt = remaining;
@@ -2245,6 +2248,8 @@ _bfd_write_archive_contents (bfd *arch)
}
}
+ free (buffer);
+
if (makemap && hasobjects)
{
/* Verify the timestamp in the archive file. If it would not be
More information about the Binutils
mailing list