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 19:28:49 +0200 Message-ID: References: <87msmu1uy5.fsf@gmail.com> <87cynq1sx0.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36612"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Helmut Eller , Eli Zaretskii , emacs-devel@gnu.org To: Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jul 06 19:29:13 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 1sQ9Dj-0009EB-8R for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Jul 2024 19:29:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQ9DV-0005sH-4b; Sat, 06 Jul 2024 13:28:57 -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 1sQ9DT-0005p5-67 for emacs-devel@gnu.org; Sat, 06 Jul 2024 13:28:55 -0400 Original-Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQ9DR-0006xR-Av; Sat, 06 Jul 2024 13:28:54 -0400 Original-Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5854ac817afso3082428a12.2; Sat, 06 Jul 2024 10:28:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720286931; x=1720891731; darn=gnu.org; h=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=du88aWhvUwdlwfCwiTd0C63MOdKblT2mDzYIZ3D+JC4=; b=ektkT+mIi40mOZYUTyXtiHAeT7k7mW0JdJvwLmDpTa94vWVr1qp3c1n5+pqO0kyW+h et+0+ENSyrIG0WZPZohw2rj8RhyHMoin0A9pBOEPLOvg8ID5RkGOYGwMKnIQonNgxtiv FCfqBh6qYvab6tsdLy88GGiCxm3o0r09rU/7+pghULpmzmE/F45MryVWqUguHD0QAlTK Dy0NDZb9bljfewcdwZVRwx7UTkgTR0vCDWWv/Ai8BKqsovDPmxM4YAnEEEiSkKSYfA2Z vXWAIeCf3mkntYy1kHJtPtqKe4cH6ju0FbnSnsG3iqKlwuDQFmsMOe4QWZzmbIGy+kCG N0AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720286931; x=1720891731; h=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=du88aWhvUwdlwfCwiTd0C63MOdKblT2mDzYIZ3D+JC4=; b=rUl8AHMrZwgEIKJIeyAUI9siQtuRG7qnQ9nzmZt8HNc33JhF/ov2HO1eOGD25jgy1i n/6z/RR4tdACGLxy515YN3WDYK1RGpHmY7ofeOy7/tJgQC/g5Q3KhMY6WERCOEcTY/qS LNn64p0JddZfYXstOwokXDqxhWbEB1l0ssDQ7KvdphszU/RW1FqZG6KZNiT2hicMFo89 o5sksXMiPlLTOmJO/PyGbJGAkpk/ADkwRvwF1bkNPUWWKc3A5C3B2ypJmdKW7utTWiVp Pkm1QxLowjcC+Xy6ONncmY8N9xHh95S/AytVZyraq8QmiebqDUZKt3BaeC+9t3M7PJs7 /rVA== X-Forwarded-Encrypted: i=1; AJvYcCVhC3eQg74CTQEEkCOYNrkiJt8xCbn3RteuHuJj1uqujg3fqB+2S/HRx65f387ugP3rG7/Yai93Rm9PX4VBMgCS8pXOTFGcxTmMR/XIcHuDGhM= X-Gm-Message-State: AOJu0YxOoDmGXCWRxAQDgoNi1iBQ7aoxo1NAKKE0CFIOxz5QKANJkbx1 MZ/fzdCDf+bnPqzbFRrI0CHFe43y5WKdVUskdQHmcK5Wxr1+tTdE0UlDpw== X-Google-Smtp-Source: AGHT+IEkqg5SQ3HZ63LhwXuTGMFC0OZut7OOfH9UpaCXh/LhT4C+ZUuRECgJjj90p6N0/Q7CK5iU4A== X-Received: by 2002:a05:6402:3496:b0:57c:61a3:546 with SMTP id 4fb4d7f45d1cf-58e5b1b752dmr5722898a12.21.1720286930758; Sat, 06 Jul 2024 10:28:50 -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-5861324f036sm11001808a12.34.2024.07.06.10.28.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 10:28:50 -0700 (PDT) In-Reply-To: (Pip Cet's message of "Sat, 06 Jul 2024 16:56:39 +0000") Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=gerd.moellmann@gmail.com; helo=mail-ed1-x536.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:321452 Archived-At: Pip Cet writes: >> We have already this in bignum.c >> >> mp_set_memory_functions (xmalloc, xrealloc_for_gmp, xfree_for_gmp); >> >> Haven't read the GMP docs yet, but that looks like something that could >> be used. > > Patch attached, couldn't resist :-) Haha :-). I'm all for it! > Memory usage is perfectly acceptable with this patch, but it does do a > lot of GC. What do the timings say? >> > I believe Eli is right, though, that we should deviate from what Emacs >> > usually does as little as possible until we've got things working. >> > That means just keeping track of how much we've allocated and calling >> > garbage_collect via maybe_garbage_collect, I think. > >> Can you explain? I mean I agree in general, but in this case I'm not so >> sure. What I've currently implemented is basically a function of the >> number of allocated finalizable objects and only finalizable objects pay >> the price. The size of allocated memory overall, i.e. counting the bytes >> in alloc_impl doesn't contain the information. > > But it's probably a better indicator of how much GC activity happened, > and that influences how many finalization messages there would be, > assuming that an approximately constant percentage of objects is > finalizable... Hm. I'm not really convinced the total amount allocated is a better predictor for how many finalzation msgs we might expect than the real number of objects for which we might expect finalization messages. But whatever. Something for later, maybe.