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.bugs Subject: bug#74097: 31.0.50; all-completions is slower on obarrays in emacs-30 than in emacs-29 Date: Wed, 30 Oct 2024 05:04:37 +0200 Message-ID: <32a2799c-4161-4b23-8d74-6f072b744f28@gutov.dev> 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="23037"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: mattias =?UTF-8?Q?engdeg=C3=A5rd?= To: 74097@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 30 04:05:32 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1t5z1X-0005qE-IC for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 30 Oct 2024 04:05:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5z1A-0006za-Ca; Tue, 29 Oct 2024 23:05:08 -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 1t5z16-0006y0-BU for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2024 23:05:05 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t5z15-0000UE-PR for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2024 23:05:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=From:MIME-Version:Date:To:Subject; bh=Zj5eLGaDqN70gHkJzVSHZC6G6zV15XAjv3WQqtPCK+g=; b=tlWTsxfjkiMAlVWn6dR3cqhC0KUoEXvCYWAXj85VRH9iA/V0G1Uu5XmbJAdde46UFHJzjlFJFv0Df18PDvTE2pq1k7oNK333ynJaMBpXTKE3Ip3Efr59kcVcodTMxIt73Wu9w2qhXvbGn+08iWUZ9vRp3KOEMp9xbS+u2AyyGSFRYUBImhVfCJYqtymUYBJbvX2cW7SWB5XSdgjdNnS2c2YzglMVtuprVkIlqZulJlZ3CXkdqJQL6mgDRrw+zkX2QaXbqh4er1csrU1jrlCxS0AzdFSsaEODwjK31lR7pw7i8Ey5o6zSQc2SV4n0rbZZ32+Vvvef8AG1AGaaS9l8Zg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t5z14-00063i-H9; Tue, 29 Oct 2024 23:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: mattiase@acm.org, bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Oct 2024 03:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74097 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: mattias =?UTF-8?Q?engdeg=C3=A5rd?= Original-Received: via spool by submit@debbugs.gnu.org id=B.173025749123275 (code B ref -1); Wed, 30 Oct 2024 03:05:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Oct 2024 03:04:51 +0000 Original-Received: from localhost ([127.0.0.1]:60613 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5z0t-00063L-9b for submit@debbugs.gnu.org; Tue, 29 Oct 2024 23:04:51 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:54918) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5z0p-00063D-1C for submit@debbugs.gnu.org; Tue, 29 Oct 2024 23:04:49 -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 1t5z0n-0006vf-EF for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2024 23:04:46 -0400 Original-Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5z0j-0000Tc-OJ for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2024 23:04:44 -0400 Original-Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id 99FAB1380459 for ; Tue, 29 Oct 2024 23:04:40 -0400 (EDT) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Tue, 29 Oct 2024 23:04:40 -0400 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:message-id:mime-version:reply-to:subject :subject:to:to; s=fm2; t=1730257480; x=1730343880; bh=Zj5eLGaDqN 70gHkJzVSHZC6G6zV15XAjv3WQqtPCK+g=; b=eFE2IOPkQIcmtKvrPVmkbzlM7h ntcuxmoTBaIiYT7iStgRe/RtS+cdQbKsyX+SiVeBv1gkkJ51Kub6G5I9Ct447MTr 08oXqjum5p1UrfgRA0XhpZ27kxzKlOqqxCxNvY/CCdmNU4xONfV1uomT5L9ryzyM siOVUTKYmSb5BPaT1t0Te1CnvSBeThhkHrFTXVx4tBBg8V6c2+hDRQRzGe46s+Vn ZjufQ04qqMyPmJVyQCtA8s/Lpob53nEPmF3wYoEHRZ4eDbcQfc/Afqps/tgDKKl7 OQ6N5KiPoonHS5qE4Fw2jzmXE1G/ERLLfQb9pRr4UatDErwL+qIlltIaHDWg== 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:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1730257480; x=1730343880; bh=Zj5eLGaDqN70gHkJzVSHZC6G6zV15XAjv3W QqtPCK+g=; b=YHjh5DZ53ZRP5wKx2B5Bf9/Ppl1HyCQwqitn+K//JZ11adR0diP kW3slMfs/5jqEFDcQMwIQbw8WKpdI1rDWRmvCA5AOos3Vnf9BpmGJwIJ5Wy9PxHx 4lrujmIIbXwWUT6OHLgPDTJaNLYYFU88dGGNhJRlFi6JmTVrcyhHOo8HnySV0vIN 4o8Txd657lMfTzSQwqlU0+wQeG80VI+LGQ4rsJjE2f9kPR/b6B9gs2EqK6UNRUQe uk8zBQhxuiS/nfigzDDYzeTDEM+SmOZKCjq9haAnUYpLWC5M+gxVTbD4Vof7wgmz XPY2ewYZBQ1tc/xcjXb87DEnClCVCydyprA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdekvddgheegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfg fvuffhtgfgsehtkeertddtvdejnecuhfhrohhmpeffmhhithhrhicuifhuthhovhcuoegu mhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrthhtvghrnhepkedvveetudekhe dugeeffeeugeehtedtveehtddufeeigeffueehteeghedvieetnecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrd guvghvpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthho pegsuhhgqdhgnhhuqdgvmhgrtghssehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 29 Oct 2024 23:04:39 -0400 (EDT) Content-Language: en-US Received-SPF: pass client-ip=103.168.172.145; envelope-from=dmitry@gutov.dev; helo=fout-a2-smtp.messagingengine.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_SBL_A=0.1 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:294542 Archived-At: X-Debbugs-Cc: Mattias EngdegÄrd This is probably not critical for most uses, but it came up in experiment: (let* ((my-size 100000) (my-obarray (let ((ob (obarray-make 1000))) (dotimes (i my-size) (intern (format "%s" i) ob)) ob)) (my-list (let (list) (dotimes (i my-size) (push (format "%s" i) list)) (nreverse list))) (s 0)) ;; Just to verify. (message "lengths obarray: %s list: %s" (progn (obarray-map (lambda (_) (cl-incf s)) my-obarray) s) (length my-list)) (message "list %s" (benchmark-run 10 (all-completions "1" my-list))) (message "obarray %s" (benchmark-run 10 (all-completions "1" my-obarray)))) In emacs-30 and emacs-31 it's 2-4x slower than on a list of strings: lengths obarray: 100000 list: 100000 obarray (0.10444341 1 0.01843060800000007) list (0.038867963 1 0.01855441899999999) lengths obarray: 100000 list: 100000 obarray (0.082519579 1 0.017577374000000034) list (0.038507061 1 0.017987661999999904) lengths obarray: 100000 list: 100000 obarray (0.09489151100000001 1 0.017720256000000045) list (0.039559388 1 0.01808564800000001) And in emacs-29 the performance is closer to a list (1.5x difference maybe): lengths obarray: 100000 list: 100000 obarray (0.04566377 1 0.014927433999999629) list (0.034239810999999995 1 0.015311175000000787) lengths obarray: 100000 list: 100000 obarray (0.048750494 1 0.015651392999999736) list (0.034873387 1 0.015080243999999965) In GNU Emacs 31.0.50 (build 41, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) of 2024-10-29 built on potemkin Repository revision: fb5915665522f747daa8dfa11e91dc406d18edb7 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12302006 System Description: Ubuntu 24.04.1 LTS