unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Antipov <dmantipov@yandex.ru>
To: rms@gnu.org
Cc: emacs-devel@gnu.org
Subject: Re: Your Emacs changes
Date: Tue, 21 Aug 2007 18:42:20 +0400	[thread overview]
Message-ID: <46CAF9CC.6030308@yandex.ru> (raw)
In-Reply-To: <E1IM8Gf-0005ZW-Qc@fencepost.gnu.org>

[-- Attachment #1: Type: text/plain, Size: 433 bytes --]

Richard Stallman wrote:

> Now that we have your papers, what changes should we install now?

Probably the thing described at http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00094.html.
Attached is the latest stuff on this.

Note the same optimization may be performed on sweeping floats.  But, since an amount of allocated
floats is too small in comparison with conses, an effect is expected to be very negligible.

Dmitry

[-- Attachment #2: fast_cons_sweep.patch --]
[-- Type: text/x-patch, Size: 1859 bytes --]

Index: alloc.c
===================================================================
RCS file: /sources/emacs/emacs/src/alloc.c,v
retrieving revision 1.414
diff -u -r1.414 alloc.c
--- alloc.c	19 Aug 2007 00:15:26 -0000	1.414
+++ alloc.c	21 Aug 2007 14:31:37 -0000
@@ -5974,23 +5974,53 @@
 
     for (cblk = cons_block; cblk; cblk = *cprev)
       {
-	register int i;
+	register int i = 0;
 	int this_free = 0;
-	for (i = 0; i < lim; i++)
-	  if (!CONS_MARKED_P (&cblk->conses[i]))
-	    {
-	      this_free++;
-	      cblk->conses[i].u.chain = cons_free_list;
-	      cons_free_list = &cblk->conses[i];
+
+	while (1)
+	  {
+	    if (cblk->gcmarkbits[i] == -1)
+	      {
+		/* Fast path - everything is marked.  */
+		cblk->gcmarkbits[i++] = 0;
+		num_used += BITS_PER_INT;
+	      }
+	    else
+	      {
+		/* Slow path - scan over each bit, from the beginning
+		   of current word to 'min (word boundary, LIM)'.  */
+		int start, stop;
+
+		start = i * BITS_PER_INT;
+		stop = lim - start;
+		if (stop > BITS_PER_INT)
+		  stop = BITS_PER_INT;
+		stop += start;
+
+		while (start < stop)
+		  {
+		    if (!CONS_MARKED_P (&cblk->conses[start]))
+		      {
+			this_free++;
+			cblk->conses[start].u.chain = cons_free_list;
+			cons_free_list = &cblk->conses[start];
 #if GC_MARK_STACK
-	      cons_free_list->car = Vdead;
+			cons_free_list->car = Vdead;
 #endif
-	    }
-	  else
-	    {
-	      num_used++;
-	      CONS_UNMARK (&cblk->conses[i]);
-	    }
+		      }
+		    else
+		      {
+			num_used++;
+			CONS_UNMARK (&cblk->conses[start]);
+		      }
+		    start++;
+		  }
+		if (stop < (++i) * BITS_PER_INT)
+		  /* Whole bitmap is scanned or LIM is reached.  */
+		  break;
+	      }
+	  }
+
 	lim = CONS_BLOCK_SIZE;
 	/* If this block contains only free conses and we have already
 	   seen more than two blocks worth of free conses then deallocate

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

       reply	other threads:[~2007-08-21 14:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1IM8Gf-0005ZW-Qc@fencepost.gnu.org>
2007-08-21 14:42 ` Dmitry Antipov [this message]
2007-08-21 16:58   ` Your Emacs changes Stefan Monnier
     [not found] <E1Gv1Kf-0002ME-7u@fencepost.gnu.org>
     [not found] ` <200612160806.16403.mark@mcs.vuw.ac.nz>
     [not found]   ` <E1GvflW-00045v-Tx@fencepost.gnu.org>
2006-12-18 11:13     ` Mark Davies
     [not found] <E1D7MTJ-0002Jj-BJ@fencepost.gnu.org>
2005-04-26 12:07 ` Arne Jørgensen
2005-04-28 11:58   ` Thien-Thi Nguyen
     [not found] <E1CuNEB-0000sr-V7@fencepost.gnu.org>
2005-01-31 14:50 ` Matt Hodges
2005-02-03  6:40   ` Richard Stallman
2004-06-02 17:37 Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2004-05-10 17:55 Richard Stallman
2004-05-02 11:19 Richard Stallman
2003-08-15 16:04 Richard Stallman
2003-08-18 15:21 ` Peter 'Luna' Runestig
2003-08-19  7:51   ` Eli Zaretskii
2003-08-19  7:36     ` Jason Rumney
2003-08-19 17:32       ` Eli Zaretskii
2003-08-22  9:58         ` Jason Rumney
2003-08-22 11:13       ` Peter 'Luna' Runestig
2003-08-19  7:59     ` Peter 'Luna' Runestig
2003-08-19 17:46       ` Eli Zaretskii
2003-08-21  7:45         ` Jason Rumney
2003-08-21  7:59         ` Jason Rumney
2002-06-15 14:13 Richard Stallman

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=46CAF9CC.6030308@yandex.ru \
    --to=dmantipov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=rms@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).