Checks
Commit Message
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(-)
Comments
Hi Oleg,
> this patch makes ar faster by increasing the buffer size from 8 KB to 8 MB.
Thanks for creating this patch. I have gone ahead and applied it.
I considered changing the patch so that the buffer size was dynamic,
using a smaller buffer if the reduce_memory_overheads flag was set
in the bfd_link_info structure. But I did not find an easy way to
get hold of that structure.
Cheers
Nick
Am Mi., 3. Mai 2023 um 17:27 Uhr schrieb Nick Clifton <nickc@redhat.com>:
>
> Hi Oleg,
>
> > this patch makes ar faster by increasing the buffer size from 8 KB to 8 MB.
>
> Thanks for creating this patch. I have gone ahead and applied it.
> I considered changing the patch so that the buffer size was dynamic,
> using a smaller buffer if the reduce_memory_overheads flag was set
> in the bfd_link_info structure. But I did not find an easy way to
> get hold of that structure.
>
> Cheers
> Nick
Thanks again, Nick.
@@ -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