From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: GC (was: lists.texi) Date: Fri, 24 Jun 2005 22:02:45 +0300 Organization: JURTA Message-ID: <87oe9v3a62.fsf_-_@jurta.org> References: <200506182319.j5INJWF08937@raven.dms.auburn.edu> <200506190015.j5J0FQk09223@raven.dms.auburn.edu> <200506190037.j5J0b9Y09287@raven.dms.auburn.edu> <200506191747.j5JHlha11521@raven.dms.auburn.edu> <200506202312.j5KNCct19091@raven.dms.auburn.edu> <200506212058.j5LKw5P23961@raven.dms.auburn.edu> <874qbqh0lm.fsf@jurta.org> <200506222025.j5MKP8S00642@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1119641679 7539 80.91.229.2 (24 Jun 2005 19:34:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 24 Jun 2005 19:34:39 +0000 (UTC) Cc: ttn@gnu.org, eliz@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 24 21:34:34 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DltwJ-0002dt-Qm for ged-emacs-devel@m.gmane.org; Fri, 24 Jun 2005 21:34:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dlu3O-0007tk-QK for ged-emacs-devel@m.gmane.org; Fri, 24 Jun 2005 15:41:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dlty6-0005ti-Is for emacs-devel@gnu.org; Fri, 24 Jun 2005 15:36:02 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dltxz-0005p9-QI for emacs-devel@gnu.org; Fri, 24 Jun 2005 15:35:56 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dltxz-0005fD-CA for emacs-devel@gnu.org; Fri, 24 Jun 2005 15:35:55 -0400 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Dltke-0004qH-2i; Fri, 24 Jun 2005 15:22:08 -0400 Original-Received: from mail.neti.ee (80-235-38-217-dsl.mus.estpak.ee [80.235.38.217]) by Relayhost1.neti.ee (Postfix) with ESMTP id B4A3C358E; Fri, 24 Jun 2005 22:18:16 +0300 (EEST) Original-To: Luc Teirlinck In-Reply-To: <200506222025.j5MKP8S00642@raven.dms.auburn.edu> (Luc Teirlinck's message of "Wed, 22 Jun 2005 15:25:08 -0500 (CDT)") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:39444 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:39444 > My test case constructed ten thousand times a list of size 1000, > triggering a lot of garbage collections. In a freshly started Emacs, > the ring-elements function I propose to install ran the test in 11 > seconds, slightly over 5 being spent in gc. This gives between 5 and > 6 for the function itself. The "abstract" version ran 37 seconds, a > little bit over 5 in gc, giving 31 to 32 for the function itself. In > other words, avoiding the `ring-ref' overhead makes the function run > more than five times faster, but the amount of consing stays the same. > > If I run the same test in a somewhat older Emacs, the functions > themselves still take 5 to 6 and 31 to 32 seconds, but now they both > spend 17.5 seconds doing gc (instead of slightly more than 5). > > I guess that in a really big Emacs, gc will take even much longer. It > is not very surprising that the more objects gc has to check, the > longer it takes. I believe this pretty much explains the gradual > slowdown of Emacs as it grows older (and hence bigger). Yes, indeed GC is what causes the slowdown. With the option `garbage-collection-messages' set to t, it is clearly visible that in a big Emacs session GC takes too much time. For example, I can see that each GC takes about 1 sec. The formula (/ gc-elapsed gcs-done) with real values (/ 1788.2 1597) gives 1.12 sec. This is substantial time for every GC to contribute to the overall slowdown. -- Juri Linkov http://www.jurta.org/emacs/