From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: MPS: weak hash tables Date: Sat, 06 Jul 2024 12:38:58 +0200 Message-ID: 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: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28083"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Pip Cet , Eli Zaretskii , Emacs Devel To: Helmut Eller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jul 06 12:39:58 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 1sQ2ph-00078K-KA for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Jul 2024 12:39:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQ2os-0002rV-4B; Sat, 06 Jul 2024 06:39:06 -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 1sQ2oq-0002qN-L9 for emacs-devel@gnu.org; Sat, 06 Jul 2024 06:39:04 -0400 Original-Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQ2oo-00068V-TP; Sat, 06 Jul 2024 06:39:04 -0400 Original-Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a77af4cd570so145984966b.1; Sat, 06 Jul 2024 03:39:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720262340; x=1720867140; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CqJlJ+/TO3o3+zYgV+6pX7Nyw/tAuJb1wneQ/7x2T9k=; b=JpmLocQbWfMm7wxETinUNw483kXCUTbj4kGtSl4iYxih/N538S8hHM3oOp8zKVMDe2 yFMBcyFRrLYHETQ7KuVDsF5hNwjVqFbzXlf4CNC5rwHd1DhpiVYmuqFqkG9ZtATCWWJ/ Y/Q5XIl2oc1r/wgikpbJCZMcKqm0g8HcXJWdnkybu624grLCGgRiabfKJd6yOwnmhFmP jd3pckdN+Pm6pazPvRf4xEh56nlkAL6gUCkddXIPsbZAEIMmQjCY3QvMhYfVBR0+8sgs S0vxhUsEhmyauLLo4BuD0Siy60UW+qpAv9UvuJhGsOW7Ax+/yMP/OQJ9XTrYIsb0SISY UKew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720262340; x=1720867140; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=CqJlJ+/TO3o3+zYgV+6pX7Nyw/tAuJb1wneQ/7x2T9k=; b=uvHH4IHbbwJX3ra3D45mEWRhcGYroB1mbqf5ezh7Sh/2dqahlLdorDiH8hYd05x9sj 3CIhTHpyVNDg0jehANY8wYokKqauKLwutKM6d+zNpwKCm2MWyzRDKjQX1kxGQ5J3Cr4G cDb4jByI+XLWf+HQcszcPJ4IYy5yC/0h9pIcg91HhnulLWEghGJ//ScnrzTOYKrIowFh LZWCQipw+oCaTiBZj7s00+kkoD15t8DF/lX0ptbdUpU2jHyeiSMMDixl5VCFPbao4XE4 znfPLXNAENkqXWrx5YEVcZiQc2E+srZFPcwIj78W44Ha7yX3o+Zg2XxMHusOqHL6IyDR oVGQ== X-Forwarded-Encrypted: i=1; AJvYcCVBk6fmXblQMpDepAT9mvJz1t0ny7SQ2qu1mLKghrMpu6n5yntZxHitfwMWHzc0b5AEzoo8l1ahnRSEnf4Rft+jnzo3qTG9P/V+6mPoPvweuoY= X-Gm-Message-State: AOJu0YxyYCbafIKJis3ci8ANFP2M8LFFmMvcPK4wVLvZgD77Q0zcdMYM K+8U4J23Hk9U1b+FSRQEkbt0N9V22IqARgg67ggZfg92DpBwSF8qnUseEQ== X-Google-Smtp-Source: AGHT+IF0Q8JxeCiCrHtNcPgPti3S0EMluK1+HYIJluMcA18x8z+o6dObMMtPetzsdUR+v6FYFGQQkQ== X-Received: by 2002:a05:6402:34c4:b0:57c:5f77:1136 with SMTP id 4fb4d7f45d1cf-58e5a4fe82bmr6605767a12.24.1720262340275; Sat, 06 Jul 2024 03:39:00 -0700 (PDT) Original-Received: from pro2.fritz.box (p4fe3a82e.dip0.t-ipconnect.de. [79.227.168.46]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-58cb2b83380sm4539093a12.74.2024.07.06.03.38.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 03:38:59 -0700 (PDT) In-Reply-To: <878qye3l81.fsf@gmail.com> (Helmut Eller's message of "Sat, 06 Jul 2024 11:47:58 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=gerd.moellmann@gmail.com; helo=mail-ej1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:321417 Archived-At: Helmut Eller writes: > On Sat, Jul 06 2024, Gerd M=C3=B6llmann 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. Hm, could be. Thanks! > 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\\)")' >=20=20 > 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.constpro= p.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. That is_dflt_fwd is so high up in the list at least hints to fact the a lot of GC work is going on. Hm, ja. I MPS copies a lot of objects during that, maybe the barriers play a role, yes. Maybe one could park the arena wile this copying is going on? Which doesn't remove the need to GC at some point, but I guess it might be faster overall.