This is the mail archive of the
mailing list for the GDB project.
[PATCH] Improve performance of large restore commands
- From: Anton Blanchard <anton at samba dot org>
- To: gdb-patches at sourceware dot org
- Date: Thu, 25 Jul 2013 22:08:58 +1000
- Subject: [PATCH] Improve performance of large restore commands
I noticed a large (100MB) restore took hours to complete. The problem
is target_xfer_partial repeatedly mallocs and memcpys the entire
100MB buffer only to find a small portion of it is actually written.
We already cap reads to 4K, so do that for writes. The testcase that
originally took hours now takes 50 seconds.
2013-07-25 Anton Blanchard <firstname.lastname@example.org>
* target.c (target_write_with_progress): Cap write to 4K
@@ -2287,9 +2287,11 @@ target_write_with_progress (struct targe
while (xfered < len)
+ /* Cap the write to 4K */
+ int to_transfer = min(4096, len - xfered);
LONGEST xfer = target_write_partial (ops, object, annex,
(gdb_byte *) buf + xfered,
- offset + xfered, len - xfered);
+ offset + xfered, to_transfer);
if (xfer == 0)