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?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: Is there utility in making hash-table-{keys, values} built-in functions? Date: Thu, 28 Nov 2024 18:31:06 +0100 Message-ID: References: Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7395"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Shankar Rao Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 28 18:32:12 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 1tGiNA-0001pY-DM for ged-emacs-devel@m.gmane-mx.org; Thu, 28 Nov 2024 18:32:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGiMI-0003UK-2t; Thu, 28 Nov 2024 12:31:18 -0500 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 1tGiMF-0003SN-7p for emacs-devel@gnu.org; Thu, 28 Nov 2024 12:31:15 -0500 Original-Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tGiMB-000396-T9 for emacs-devel@gnu.org; Thu, 28 Nov 2024 12:31:13 -0500 Original-Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-53df1e0641fso1245677e87.1 for ; Thu, 28 Nov 2024 09:31:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732815070; x=1733419870; darn=gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=de4ZGmSb5KzCwHXrKQVg6BymLDjeiyYm9sCuTA16isE=; b=mYkSQjsmGb04/E4QhP+fSI61iQrUdP3vegRLTOnfyRwIgh9uAJtpKjZNUSUrv5W9Sd RyGHC2oa+7vD4gmYtPMBoTP2h9FtjJQuyDU5DIn16xGiqvOToRLwaQPdfoJ+7+MWZ1bl /SjhoJUVO8PJnWh41mqcOZucQYX0wGWyU2vdMN2ravQtUwiM+soYQ9+PjwIm3ud0F5B4 +eTLiuekQ5y0K3jitlS961eA0ldTOqSWcpBKuGlA8eiMkp0sWvgNdc7wUe2RfJAsd1xy DOjRpr5zre28w9zW1ihxOSUGlPXyKnzWs3Hq1o0PTt61rYBugqFF01BGeWQ4v8JyZyBF srrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732815070; x=1733419870; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=de4ZGmSb5KzCwHXrKQVg6BymLDjeiyYm9sCuTA16isE=; b=jeynqACzaQFkwGd9eYKaFJIS6Gm3M0v8ReQQlNhMz0ZwtG9ZUD2vgJ2pC2Y+w0nwhW M6b2kyhA60Iq46iEWctCJdyCMwNi39pcKHzxvJFlcjqLxmOxHQCyRX/0L4tVXVCCg33r aS+WJurC74ckMZ9XhyioZG7Wng7GjH6K+6o/h9FQ4+1a6icD68JaT1dM6hKzUpL1cJQM tkcCXDGQ6T2F4TBgede2plZqM2AHGjpIg2kkVRyABHXfjj7szzmkANBaIKvRmvKIlKlY x+QI65s/4aBJDwID4mRYdD39++IzqSqR9lh8yxrwqg8Yt7DgKU1OTeWssnSZlm72tyxi xlfg== X-Gm-Message-State: AOJu0YzbohIBeKvJha4J9MUZAnKlgold8djfhG8ejlsIRWI5kBTovUK/ MI8lOoCkJu84HEwl9VcSl4WXaecyFNj3OyGY4YXqYhrgoq4Gy9wJ X-Gm-Gg: ASbGncveBbVvcf2gaQQ+8MW1nN3CkbglU57/ZrWxt15+crNuJNnGvpDnOK+bylnm/JK 6P6aOCh8OB9Tqmfd8xRaBLuu9mo5jNwGuhiMmZwHusAVPyBBlqHnX8YpJ6HRPgrCCnD38Z0LMDT xnCrtE2JMvhm73shQ8vGW0iZ/CUOOZ6c2velxIg0sjdsEjuZWWD0vVOiwE9qi/e5ofQrZd9iA7Z 8Wv+sFyHtKstbxYrz4Ge8OXc2uTHsyYS+D1/G1W2/io6siacpNnU1htCQ8oFhfTjqmkEjaJhWUx hIK27gxbUoHOp+y5t6ElV/35iNmh9IzI4xGc0+My X-Google-Smtp-Source: AGHT+IG5Gw9xiTqyQZ9qBUmXbpDLUlAJ9B5mjLBY9JbKlJucBy+ybfDct72zKGnBPpDc2ZVRyli9Cg== X-Received: by 2002:a05:6512:acb:b0:53d:de12:ef25 with SMTP id 2adb3069b0e04-53df00d1b59mr4455265e87.19.1732815069411; Thu, 28 Nov 2024 09:31:09 -0800 (PST) Original-Received: from smtpclient.apple (c188-150-183-180.bredband.tele2.se. [188.150.183.180]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53df649f7a1sm233981e87.254.2024.11.28.09.31.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Nov 2024 09:31:09 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3654.120.0.1.15) Received-SPF: pass client-ip=2a00:1450:4864:20::12d; envelope-from=mattias.engdegard@gmail.com; helo=mail-lf1-x12d.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:325826 Archived-At: 28 nov. 2024 kl. 12.53 skrev Shankar Rao : > I noticed that the functions hash-table-keys and hash-table-values are = just wrappers around maphash. This means that there is no way to iterate = over a hash-table without using a lambda. >=20 > Would it be useful or worthwhile to implement these directly in C? I = don't know much about low-level Emacs development, but having these as = built-ins could make iteration of a hash-table a little faster and = easier to debug. It's unlikely that it would be faster to make a list just for the = purpose of a single iteration; the allocation costs alone would be too = high. Other ways of iterating through hash-tables have been tried with = mostly disappointing results, although there might be some value in = avoiding use of the C stack in some cases. If you tell us what you are trying to accomplish, it would be easier for = us to help you.