emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109727: * lisp.h (vcopy): Use memcpy


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109727: * lisp.h (vcopy): Use memcpy rather than our own loop.
Date: Tue, 21 Aug 2012 10:18:21 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109727
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Tue 2012-08-21 10:18:21 -0700
message:
  * lisp.h (vcopy): Use memcpy rather than our own loop.
  
  This fixes a performance regression introduced by the recent
  addition of vcopy.  This means 'vcopy' will need to be modified
  for a copying collector, but that's OK.  Also, tighten the
  checking in the assertion.
modified:
  src/ChangeLog
  src/lisp.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-08-21 17:14:08 +0000
+++ b/src/ChangeLog     2012-08-21 17:18:21 +0000
@@ -1,3 +1,11 @@
+2012-08-21  Paul Eggert  <address@hidden>
+
+       * lisp.h (vcopy): Use memcpy rather than our own loop.
+       This fixes a performance regression introduced by the recent
+       addition of vcopy.  This means 'vcopy' will need to be modified
+       for a copying collector, but that's OK.  Also, tighten the
+       checking in the assertion.
+
 2012-08-21  Eli Zaretskii  <address@hidden>
 
        * w32uniscribe.c (uniscribe_shape): Fix producing gstring

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2012-08-21 10:21:04 +0000
+++ b/src/lisp.h        2012-08-21 17:18:21 +0000
@@ -2349,11 +2349,8 @@
 LISP_INLINE void
 vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count)
 {
-  ptrdiff_t i;
-
-  eassert (offset + count <= ASIZE (v));
-  for (i = 0; i < count; i++)
-    ASET (v, offset + i, args[i]);
+  eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v));
+  memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args);
 }
 
 /* Functions to modify hash tables.  */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]