From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: scratch/hash-table-perf 2d28042f56a 19/35: Use non-Lisp allocation for internal hash-table vectors Date: Thu, 4 Jan 2024 19:32:59 +0200 Message-ID: <8d49ebdc-9da7-4e70-a080-d8e892b980b6@gutov.dev> References: <170438379722.3921.9312235725296561206@vcs2.savannah.gnu.org> <20240104155642.B4A99C00344@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35367"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: emacs-devel@gnu.org, =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jan 04 18:34:10 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 1rLRbd-0008wF-7d for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Jan 2024 18:34:10 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLRak-00027f-1d; Thu, 04 Jan 2024 12:33:14 -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 1rLRaf-00024w-OS for emacs-devel@gnu.org; Thu, 04 Jan 2024 12:33:11 -0500 Original-Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLRad-00054i-Ln for emacs-devel@gnu.org; Thu, 04 Jan 2024 12:33:09 -0500 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 0D3753200B64; Thu, 4 Jan 2024 12:33:03 -0500 (EST) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 04 Jan 2024 12:33:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1704389583; x=1704475983; bh=NEZ7w//dfvflK8KW17svOdq9gV2rEiJGdK6TPR89+Bg=; b= fqBmlpfK9M9RetJ2y6P4On46s+1Xyr7/QOYDAl8fs8tEia7t3wTw6KTvcJn1yDMB leLajjSs6Avd+Dvtiv51VmA2FhjWtMHguVBCWW2KtiXy2jhsq+TfiMBKwTMfcohf KQWIk5aQzKmKKCUZFm0pua+jA0vD+DjUCUNAWn1aEyb5YKeyj+HcyL40tY0L3zYp aIf52h1vRRjTogUWzK54sML2ELO0xS2eUDEtWc4tNz5HrAL3QWCQcCGTLHl9DRl7 sVB4Ej14CHouimZBGeNom3u9tJHcoCFHnHffM5UxREddA5UxbESc7nnnzjfxEHH+ dYvlyJF+8wa2zU2iYlfLUA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1704389583; x= 1704475983; bh=NEZ7w//dfvflK8KW17svOdq9gV2rEiJGdK6TPR89+Bg=; b=6 K/4oEpU/5wJ4cJxeVkjMuFg1jDFdQK6bOyK8a7oMgxZcR+EJOABU4XicgYl5tqj+ WErKMBgqcmPtqDojXC9efHJGd7MsO4p1csSfT0LG22noZ4ZKuZ5OqBsEMw9dq5u4 aeBoe9jSZklrn8eZBhnBwap5uilERc7T8ZIgTxuWNm+FGC9APG906GYscMiuhfao 9F+kqOVwl8qN3UCvBaxRmrpkEsVCIomqQuPD2+cW2owhuJMy2zoi+ERIcEKjJ/o9 K6ZgXDH/M1RqhMM58APx+vGqN9GBjARSAHwTt+WFVOmJbB8kKJi8tF90sPknWpbi zUg2JTrjw5YftAGlm+CEQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdegjedguddtudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepgeeugeetffduvdejvedvleeliedtfedtudfhfeefffejudekveejvdeffffg veegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 4 Jan 2024 12:33:02 -0500 (EST) Content-Language: en-US In-Reply-To: <20240104155642.B4A99C00344@vcs2.savannah.gnu.org> Received-SPF: pass client-ip=64.147.123.19; envelope-from=dmitry@gutov.dev; helo=wout3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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:314541 Archived-At: On 04/01/2024 17:56, Mattias EngdegÄrd wrote: > +/* Like xmalloc, but makes allocation count toward the total consing. > + Return NULL for a zero-sized allocation. */ > +void * > +hash_table_alloc_bytes (ptrdiff_t nbytes) > +{ > + if (nbytes == 0) > + return NULL; > + tally_consing (nbytes); > + return xmalloc (nbytes); > +} Sorry if it's a stupid question, but if the operation doesn't add any Lisp "garbage", why increase the consing counter? That is likely triggers more GCs earlier which otherwise might not run, and if there are no slots to GC, it seems like they would run in vain.