From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: MPS: weak hash tables Date: Sat, 06 Jul 2024 15:49:56 +0000 Message-ID: References: <86a5iu4tiy.fsf@gnu.org> <87msmu1uy5.fsf@gmail.com> <87cynq1sx0.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="28088"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Helmut Eller , Eli Zaretskii , emacs-devel@gnu.org To: =?utf-8?Q?Gerd_M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jul 06 18:21:55 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 1sQ8Ab-00078c-Or for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Jul 2024 18:21:53 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQ8A8-0005c2-FW; Sat, 06 Jul 2024 12:21:24 -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 1sQ7fq-00017Y-AG for emacs-devel@gnu.org; Sat, 06 Jul 2024 11:50:06 -0400 Original-Received: from mail-40134.protonmail.ch ([185.70.40.134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQ7fn-0006wH-LN for emacs-devel@gnu.org; Sat, 06 Jul 2024 11:50:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1720281000; x=1720540200; bh=J5WPXWoHigDE0ksYKy+FmY8SGsXD7ubeUx6/LrHt3vM=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=d0nZ6oqoXdxCJ4Riqawzhl+y15CAvIdybLN42rpLx26HSOr/5iIIGFgAd9PUyJUH+ 9FBviBsNQXGv3zBuY6ty94q9rmHTfP48Mu1LLvvi733kuy9pvxiOL9rsTMj+3xdy+P Pfm5tRpHkZlQ9VVIAVRvhs8HNRRpGFm2CB+mPfNQjXopLqmWBD62x3qrC+fFWVYXIB mwuP2RBOQilCtkdxWKi5+1WS9DjfA2v1SIDAuzYWGMxFxx0zKpne1RAv5PRbGtbtXD jTarjVk+Jj56eTaIUSdHl57ZhbnO7VFQ8T8cDeYJWYIM2xemS/SqYLWOaohWMBnowR H2EcBEnaZVZjQ== In-Reply-To: Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 32bbddc218c2265d068ce8b85d032febfcd0438a Received-SPF: pass client-ip=185.70.40.134; envelope-from=pipcet@protonmail.com; helo=mail-40134.protonmail.ch 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, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 06 Jul 2024 12:21:22 -0400 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:321444 Archived-At: On Saturday, July 6th, 2024 at 14:52, Gerd M=C3=B6llmann wrote: > Helmut Eller eller.helmut@gmail.com writes: >=20 > > On Sat, Jul 06 2024, Gerd M=C3=B6llmann wrote: > >=20 > > > > finishes and requires 41.82 seconds compared to the 12.26 of the no= n-MPS > > > > version. And it uses something like 2.8 GB compared to 350 MB of th= e > > > > non-MPS version (estimated by looking at the RES column in top). > >=20 > > Scratch that. That had some MPS_KEY_COMMIT_LIMIT in there. > >=20 > > > So 1000 is probably to high for that that use case, or 0.1s is too lo= w, > > > especially in batch mode. Grmpf. Could you try with 100 instead of 10= 00? > >=20 > > This is should be better: > >=20 > > N Seconds RES > > 1 65.10 920MB > > 10 49.59 1GB > > 50 45.75 1.4GB > > 100 43.50 2.8GB > > 500 42.14 2.6GB > > 1000 41.98 2.6GB > >=20 > > As before the RES column is what I saw in top (sampled every 3 seconds)= . >=20 > Thanks! I've made it so that in batch mode we don't put a time limit on > processing messages because that made no sense. >=20 > Hm. Don't know how to do better at the moement. The message passing > itself is of course costly. I wonder how representative that is of actual workloads, though. It does ap= pear mostly to be the cost of finalization, if I deactivate that (and leak = the memory instead!) it takes about 6.5 seconds on this machine compared to= ~9 on my main Emacs. Totally unscientific, of course, I'm pretty sure I ev= en updated my compiler since compiling vanilla Emacs. Both use nativecomp. So IF it's worth optimizing this, the thing to look into would be to use MP= S-managed memory for GMP bignums, so we don't need a finalizer at all. I th= ink that's quite easy to do, but requires violating the GMP API by accessin= g internal member fields directly. I believe Eli is right, though, that we should deviate from what Emacs usua= lly does as little as possible until we've got things working. That means j= ust keeping track of how much we've allocated and calling garbage_collect v= ia maybe_garbage_collect, I think. As for memory usage, I wonder how much of that is MPS memory and how much i= s simply the limbs of the bignums, which MPS doesn't know about. My guess i= s pidgits uses large bignums, but MPS only sees the small mpz_t allocations= . Pip