Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Improve performance of large restore commands
@ 2013-07-25 12:09 Anton Blanchard
  2013-07-25 17:30 ` Luis Machado
  2013-07-25 17:59 ` Pedro Alves
  0 siblings, 2 replies; 9+ messages in thread
From: Anton Blanchard @ 2013-07-25 12:09 UTC (permalink / raw)
  To: gdb-patches


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  <anton@samba.org>

	* target.c (target_write_with_progress): Cap write to 4K

Index: b/gdb/target.c
===================================================================
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -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)
 	return xfered;


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-07-31 14:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-25 12:09 [PATCH] Improve performance of large restore commands Anton Blanchard
2013-07-25 17:30 ` Luis Machado
2013-07-25 17:59 ` Pedro Alves
2013-07-29  5:45   ` Anton Blanchard
2013-07-29 14:14     ` Pedro Alves
2013-07-29 23:25       ` Anton Blanchard
2013-07-30 11:33         ` Pedro Alves
2013-07-31 12:35           ` Anton Blanchard
2013-07-31 14:47             ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox