unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
To: Dan Nicolaescu <dann@ics.uci.edu>
Cc: emacs-devel@gnu.org
Subject: Re: profiling emacs-23.1 vs emacs-22.3
Date: Tue, 25 Aug 2009 15:07:50 +0900	[thread overview]
Message-ID: <E1MfpCA-0000tG-EZ@etlken> (raw)
In-Reply-To: <200908241826.n7OIQRhS001092@godzilla.ics.uci.edu> (message from Dan Nicolaescu on Mon, 24 Aug 2009 11:26:27 -0700 (PDT))

In article <200908241826.n7OIQRhS001092@godzilla.ics.uci.edu>, Dan Nicolaescu <dann@ics.uci.edu> writes:

> Kenichi Handa <handa@m17n.org> writes:
> In article <200908240807.n7O87ubg024643@godzilla.ics.uci.edu>, Dan Nicolaescu <dann@ics.uci.edu> 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
handa@m17n.org

2009-08-25  Kenichi Handa  <handa@m17n.org>

	* 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	other threads:[~2009-08-25  6:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-03 20:29 profiling emacs-23.1 vs emacs-22.3 Dan Nicolaescu
2009-08-04 17:10 ` Leo
2009-08-04 19:50 ` Chong Yidong
2009-08-04 19:56   ` Dan Nicolaescu
2009-08-05  7:47 ` Dan Nicolaescu
2009-08-24  6:52 ` Kenichi Handa
     [not found]   ` <200908240807.n7O87ubg024643@godzilla.ics.uci.edu>
2009-08-24 11:39     ` Kenichi Handa
2009-08-24 18:26       ` Dan Nicolaescu
2009-08-25  6:07         ` Kenichi Handa [this message]
2009-08-25 18:47           ` Dan Nicolaescu
2009-08-26  6:01             ` Kenichi Handa
2009-08-26  6:33               ` Dan Nicolaescu
2009-08-26  8:06                 ` Kenichi Handa
2009-08-26 20:46                   ` Andreas Schwab
2009-08-27  2:02                     ` Kenichi Handa
2009-08-27  6:27               ` Kenichi Handa
2009-08-24 22:18       ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1MfpCA-0000tG-EZ@etlken \
    --to=handa@m17n.org \
    --cc=dann@ics.uci.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).