From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: NS port: How to debug excessive garbage collection? Date: Sat, 13 Apr 2019 20:47:02 -0700 Message-ID: <1f67b152-c249-e265-9852-035c3c0a8530@dancol.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="222143"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Cc: Eli Zaretskii , emacs-devel@gnu.org To: Keith David Bershatsky , Alex Gramiak Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 14 05:48:00 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFW7b-000vf2-E3 for ged-emacs-devel@m.gmane.org; Sun, 14 Apr 2019 05:47:59 +0200 Original-Received: from localhost ([127.0.0.1]:58966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFW7a-00010b-Aw for ged-emacs-devel@m.gmane.org; Sat, 13 Apr 2019 23:47:58 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFW6p-00010Q-RG for emacs-devel@gnu.org; Sat, 13 Apr 2019 23:47:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hFW6o-0003Wr-H3 for emacs-devel@gnu.org; Sat, 13 Apr 2019 23:47:11 -0400 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:50838) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hFW6o-0003Vh-5v; Sat, 13 Apr 2019 23:47:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject; bh=NPxpU+35ShEnXX2v/6jH9Y3IFN+la9KyQcBCpEndX8I=; b=Dzx5BPlYH2Wxpxs35TqNoI1F9PNuDEJy62aE1Uv9LvfCQXxA+Y1Imyp2aS0s8cP19Fd9973K9wA5lRejuUpYTDNmu/c2EoX0l132q5VTcLcSS3c/fLDnLuF0Sdo2/gmKCYM2H2BpWiSy0gN6/rQYzaHBFCDfTBFzmSTIDJZsLZPyeFp3GWtd0dL+5ZhS+wL8AQD7emUznbXCGSovf+dEk+vAdwcx3veXa4KGdMxRdClIzp6JRrWl6bczeA9j2ApaD/rR7my4QuXpV25dfPg66nFL/qmLFpQJGN4PlMdIVbovShBZN0oulh69SL3d3S40J19McU5QEXkrd8H/LOoSFA==; Original-Received: from [2604:4080:1321:9a00:fc2a:787c:f84c:2105] by dancol.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1hFW6l-0002BI-QY; Sat, 13 Apr 2019 20:47:07 -0700 In-Reply-To: Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2600:3c01::f03c:91ff:fedf:adf3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:235424 Archived-At: On 4/13/19 11:07 AM, Keith David Bershatsky wrote: > Thank you, Alex, for helping to diagnose the issue of excessive garbage collection. I observe the issue when building Emacs on an OSX machine using the --with-ns flag. The issue may also occur on the w32 and X11 builds of Emacs, but it is not noticeable to my naked eye. The NS build, on the other hand, permits me to see an appreciable pause for garbage collection every few keystrokes. The garbage collection tests with *_consed that I performed today were on the NS port of Emacs. > > The usage of Ftruncate in the 04/08/2019 proof concept patch of fake cursors occurs only in w32term.c and xterm.c. > > My general understanding is as follows: > > 1. Emacs uses nsterm.m/h when building on an OSX machine and the --with-ns flag. > > 2. Emacs uses xterm.c when building on an OSX machine that has X11 installed and the following flags are used: --with-x (yes) and --with-ns (no). > > 3. Emacs uses w32term.c when building on a Windows machine. > > I would be pleased to remove Ftruncate and replace it with roundf. Thank you for the suggestion. The development of the fake cursors feature has been a work in progress for a little over 3 years now ... learning some C coding along the way. I have seen roundf in a few internet examples over the years, and have a vague recollection of trying to use it somewhere -- however, I cannot remember in what context. > > Perhaps there is a similar mistake I have made that would affect the NS build of Emacs, or perhaps would affect all of the builds (NS/w32/X11). It is interesting that excessive garbage collection occurs even with the fake cursors feature turned _off_, and it gets much worse when that feature is turned _on_. > > Keith > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > >> Date: [04-13-2019 10:02:07] <13 Apr 2019 11:02:07 -0600> >> From: Alex Gramiak >> To: Keith David Bershatsky >> Cc: Eli Zaretskii , emacs-devel@gnu.org >> Subject: Re: NS port: How to debug excessive garbage collection? >> >> Keith David Bershatsky writes: >> >>> ;;; begin STOCK / UNMODIFIED >>> [...] >>> ((cons_cells_consed 2455285) >>> (symbols_consed 16084) >>> (strings_consed 104220) >>> (string_chars_consed 2152636) >>> (vector_cells_consed 6884284) >>> (floats_consed 572) >>> (intervals_consed 112)) >>> >>> >>> ;;; end STOCK UNMODIFIED >>> >>> ============================ >>> >>> ;;; begin MODIFIED -- CROSSHAIRS "OFF" >> >>> [...] >>> ((cons_cells_consed 2408250) >>> (symbols_consed 16120) >>> (strings_consed 112081) >>> (string_chars_consed 2208228) >>> (vector_cells_consed 6903029) >>> (floats_consed 23104) >>> (intervals_consed 112)) >>> >>> ;;; end MODIFIED -- CROSSHAIRS "OFF" >>> >>> ============================ >>> >>> ;;; begin MODIFIED -- CROSSHAIRS "ON" >>> >>> [...] >>> ((cons_cells_consed 2471395) >>> (symbols_consed 16122) >>> (strings_consed 111473) >>> (string_chars_consed 2209234) >>> (vector_cells_consed 6898322) >>> (floats_consed 19817) >>> (intervals_consed 112)) >> >> Your floats look out of control. I checked your latest diff, and found >> this: >> >> + int int_red = XFIXNUM (Ftruncate (make_float (term_red), Qnil)); >> + int int_green = XFIXNUM (Ftruncate (make_float (term_green), Qnil));; >> + int int_blue = XFIXNUM (Ftruncate (make_float (term_blue), Qnil));; >> >> Why do you make a Lisp float just to truncate it? Can you run your test >> again using one of the following? I really wish we had a generational collector. :-(