From: Oleg Tolmatcev <oleg.tolmatcev@gmail.com>
To: binutils@sourceware.org
Subject: [PATCH] make ar faster
Date: Fri, 28 Apr 2023 01:35:20 +0200 [thread overview]
Message-ID: <CACcXsZi9c641-gEbCZbP0=Ni+sJKbEwW3gV6CMpT4wOjks85dg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]
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
next reply other threads:[~2023-04-27 23:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-27 23:35 Oleg Tolmatcev [this message]
2023-05-03 15:27 ` Nick Clifton
2023-05-03 18:10 ` Oleg Tolmatcev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACcXsZi9c641-gEbCZbP0=Ni+sJKbEwW3gV6CMpT4wOjks85dg@mail.gmail.com' \
--to=oleg.tolmatcev@gmail.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).