emacs-devel
[Top][All Lists]
Advanced

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

Re: profiling emacs-23.1 vs emacs-22.3


From: Kenichi Handa
Subject: Re: profiling emacs-23.1 vs emacs-22.3
Date: Tue, 25 Aug 2009 15:07:50 +0900

In article <address@hidden>, Dan Nicolaescu <address@hidden> writes:

> Kenichi Handa <address@hidden> writes:
> In article <address@hidden>, Dan Nicolaescu <address@hidden> writes:
> 
> > Could you try the attached patch?  If it improves the
> 
> > It does improve performance:
> 
> How much in real time?

> from 22 seconds to 19 (vs about 16 for 22.3 )

I see.  Then it is worth installing that patch.  I've just
done it.

> [...]
> > It's still slower than 22.3 though.
> 
> > One big difference is then time/number of calls to mark_objects 
> > 129733 vs 18834514, so 145 times more calls to mark_object.
> > Do you know where do those come from?
> 
> > The number of Fgarbage_collect calls does not increase that much: 
> > from 37 (for 22.3) to  43 (for 23.1).
> 
> It seems that c-indent-region has been changed a lot.  I'm
> not sure, but perhaps that is the reason.  How do the other
> people think?

> I set the load path to cc-mode from 22.3, it did not make any significant
> difference in the amount of mark_object and Fgarbage_collect calls.

Ok, then I suspect that the slowness is because of newly
introduced char-tables.  I've just installed the attached
change too to improve the performance of object marking in
GC.

Please try again with the latest code.

---
Kenichi Handa
address@hidden

2009-08-25  Kenichi Handa  <address@hidden>

        * alloc.c (mark_char_table): New function.
        (mark_object): Use mark_char_table for a char-table.

--- alloc.c.~1.448.~    2009-08-17 21:17:19.000000000 +0900
+++ alloc.c     2009-08-25 15:01:28.000000000 +0900
@@ -5371,6 +5371,34 @@
   return 1;
 }
 
+/* Like mark_vectorlike but optimized for char-tables (and
+   sub-char-tables) assuming that the contents are mostly integers or
+   symbols.  */
+
+static void
+mark_char_table (ptr)
+     struct Lisp_Vector *ptr;
+{
+  register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK;
+  register int i;
+
+  VECTOR_MARK (ptr);
+  for (i = 0; i < size; i++)
+    {
+      Lisp_Object val = ptr->contents[i];
+
+      if (INTEGERP (val) || SYMBOLP (val) && XSYMBOL (val)->gcmarkbit)
+       continue;
+      if (SUB_CHAR_TABLE_P (val))
+       {
+         if (! VECTOR_MARKED_P (XVECTOR (val)))
+           mark_char_table (XVECTOR (val));
+       }
+      else
+       mark_object (val);
+    }
+}
+
 void
 mark_object (arg)
      Lisp_Object arg;
@@ -5533,6 +5561,11 @@
                VECTOR_MARK (XVECTOR (h->key_and_value));
            }
        }
+      else if (CHAR_TABLE_P (obj))
+       {
+         if (! VECTOR_MARKED_P (XVECTOR (obj)))
+           mark_char_table (XVECTOR (obj));
+       }
       else
        mark_vectorlike (XVECTOR (obj));
       break;




reply via email to

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