From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: MPS: weak hash tables Date: Sat, 06 Jul 2024 14:13:58 +0300 Message-ID: <86ikxi4vt5.fsf@gnu.org> References: <-plQctKgNkvp-LJ9ov2QAiXQKxd9V-hI0yz_opRGxQtbknubCjH4rH2-ymgbw_Qr1ZhB1rtlmiEW8XtuIVNr7nR_Yj20AH6WkH6kUGp68g0=@protonmail.com> <_mNcR6ailVKpYHLxgfo_tJlYGeR0AQIzQWluspYYp5_g5pIIKkHLNfFkklQQgOKNiVW8jn8NS3i2dJ7_B2Qyx9v-Dq3MQ9mP8HNL30UWsqY=@protonmail.com> <878qyf4sgm.fsf@gmail.com> <878qye3l81.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4152"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, pipcet@protonmail.com, emacs-devel@gnu.org To: Helmut Eller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jul 06 13:15:01 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sQ3Nc-0000nM-5O for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Jul 2024 13:15:00 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQ3Mi-000704-Rm; Sat, 06 Jul 2024 07:14:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQ3Mg-0006zq-SP for emacs-devel@gnu.org; Sat, 06 Jul 2024 07:14:02 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQ3Mg-0003bo-AG; Sat, 06 Jul 2024 07:14:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=ih62A0KYuAOED36p4xsG+InAyry3AmfC5ZCdZM5PbS0=; b=iNG5RtmpJDmLJV38gvIK BG8zXNRHTR87yRsh8tdC6twowyoXzkxnpoV24PVNQmNbei5EzLLUMWs/nGOvkE70gwimVfWdD2U4I xE8bjAgjm3OsJ8e4zeBow4k/CAPPcH7/TJOPeHoxrXmTyNJ0Y617S6i1x+x2plSGTAEIa5RuwiSeS xjFSoI5LI9e5tAxrKf7wrJnkGr2FfSwFk35p9NXUJhxIp0RFPh+xPvXG5M5HKq+8ohg7GMxY4hixd iP2xUs/51zRpcffMvIDQOnn/ul6aGJTqOFGbc2HV43y0oUr3RjjVibpf8EPUhXZohifW2aIoolo8z NanfDR8HScL+VQ==; In-Reply-To: <878qye3l81.fsf@gmail.com> (message from Helmut Eller on Sat, 06 Jul 2024 11:47:58 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:321422 Archived-At: > From: Helmut Eller > Cc: Pip Cet , Eli Zaretskii , Emacs > Devel > Date: Sat, 06 Jul 2024 11:47:58 +0200 > > On Sat, Jul 06 2024, Gerd Möllmann wrote: > > >> ert-tests.el worries me the most. There, MPS looks pretty bad compared > >> to the old GC. (Who would have thought that printing backtraces > >> involves copying and rebalancing interval trees with thousands of nodes? > >> And why does it perform so poorly with a generational GC?) > > > > Hm, sounds almost like a bug to me. The bug being the copying. Why does > > it do that, do you know? > > One reason may be that something tries to remove invisible text with > buffer-substring. That needs to copy part of the interval tree. But > the copying happens for both, the MPS and the non-MPS version. > > When I run > > perf record ../src/emacs -Q --batch -l lisp/emacs-lisp/ert-tests.el > --eval '(ert-run-tests-batch-and-exit > "ert-test-\\(parse\\|plist\\|record\\|run-tests-batch-exp\\)")' > > then the top entries in the perf output for the MPS version looks like: > > 9.55% emacs emacs [.] balance_an_interval > 5.46% emacs emacs [.] amcSegFix > 5.20% emacs emacs [.] exec_byte_code > 3.71% emacs emacs [.] _mps_fix2 > 3.10% emacs emacs [.] fix_lisp_obj > 2.81% emacs emacs [.] SegSetGrey > 2.37% emacs emacs [.] shieldQueue > 2.29% emacs emacs [.] SegFix > 2.24% emacs emacs [.] is_dflt_fwd > 2.07% emacs emacs [.] alloc_impl > 2.02% emacs emacs [.] dflt_scan_obj.constprop.0 > > and the non-MPS version: > > 19.63% emacs emacs [.] balance_an_interval > 10.22% emacs emacs [.] exec_byte_code > 9.73% emacs emacs [.] process_mark_stack > 3.04% emacs emacs [.] next_interval > 2.42% emacs emacs [.] sweep_intervals > 2.26% emacs emacs [.] Fmemq > 2.16% emacs emacs [.] find_interval > 2.05% emacs emacs [.] Fcons > > So balance_an_interval is pretty high in both, but it seems that the GC > related part is quite a bit bigger for the MPS version. Maybe it has > something to do with memory barriers. Isn't the call to balance_an_interval made from sweep_buffers and sweep_strings? We balance the intervals of the buffers and strings that survived GC, to make accessing these trees faster. How did you conclude that rebalancing interval trees is needed for printing backtraces?