]> code.delx.au - gnu-emacs/commitdiff
Speed up insertion of subprocess output on MS-Windows.
authorEli Zaretskii <eliz@gnu.org>
Wed, 1 Feb 2012 16:51:20 +0000 (18:51 +0200)
committerEli Zaretskii <eliz@gnu.org>
Wed, 1 Feb 2012 16:51:20 +0000 (18:51 +0200)
 src/ralloc.c (resize_bloc, r_alloc_sbrk): Don't call memmove if its
 first 2 arguments are identical.  This makes inserting large
 output from a subprocess an order of magnitude faster on
 MS-Windows, where all sbrk'ed memory is always contiguous.

src/ChangeLog
src/ralloc.c

index 81b5295a0c90ce83a53a0b080acaddbc9c21cbcf..6d647530ad21f89f8522f0531a546274b7e6828d 100644 (file)
@@ -1,3 +1,10 @@
+2012-02-01  Eli Zaretskii  <eliz@gnu.org>
+
+       * ralloc.c (resize_bloc, r_alloc_sbrk): Don't call memmove if its
+       first 2 arguments are identical.  This makes inserting large
+       output from a subprocess an order of magnitude faster on
+       MS-Windows, where all sbrk'ed memory is always contiguous.
+
 2012-01-31  Glenn Morris  <rgm@gnu.org>
 
        * nsterm.m (syms_of_nsterm) <x-toolkit-scroll-bars>:
index 13587b9ffd455ab9958ccbc1d12817e61b879c55..896ad9f3155b06fde7914f889f3d2c9fa2e777fb 100644 (file)
@@ -636,7 +636,8 @@ resize_bloc (bloc_ptr bloc, SIZE size)
             }
          else
            {
-             memmove (b->new_data, b->data, b->size);
+             if (b->new_data != b->data)
+               memmove (b->new_data, b->data, b->size);
              *b->variable = b->data = b->new_data;
             }
        }
@@ -647,7 +648,8 @@ resize_bloc (bloc_ptr bloc, SIZE size)
        }
       else
        {
-         memmove (bloc->new_data, bloc->data, old_size);
+         if (bloc->new_data != bloc->data)
+           memmove (bloc->new_data, bloc->data, old_size);
          memset ((char *) bloc->new_data + old_size, 0, size - old_size);
          *bloc->variable = bloc->data = bloc->new_data;
        }
@@ -663,7 +665,8 @@ resize_bloc (bloc_ptr bloc, SIZE size)
             }
          else
            {
-             memmove (b->new_data, b->data, b->size);
+             if (b->new_data != b->data)
+               memmove (b->new_data, b->data, b->size);
              *b->variable = b->data = b->new_data;
            }
        }
@@ -816,7 +819,8 @@ r_alloc_sbrk (long int size)
             header.  */
          for (b = last_bloc; b != NIL_BLOC; b = b->prev)
            {
-             memmove (b->new_data, b->data, b->size);
+             if (b->new_data != b->data)
+               memmove (b->new_data, b->data, b->size);
              *b->variable = b->data = b->new_data;
            }
 
@@ -862,7 +866,8 @@ r_alloc_sbrk (long int size)
 
          for (b = first_bloc; b != NIL_BLOC; b = b->next)
            {
-             memmove (b->new_data, b->data, b->size);
+             if (b->new_data != b->data)
+               memmove (b->new_data, b->data, b->size);
              *b->variable = b->data = b->new_data;
            }
        }