GNU bug report logs - #74097
31.0.50; all-completions is slower on obarrays in emacs-30 than in emacs-29

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Dmitry Gutov <dmitry@HIDDEN>; dated Wed, 30 Oct 2024 03:05:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'minor' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 30 Oct 2024 03:04:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 29 23:04:51 2024
Received: from localhost ([127.0.0.1]:60613 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t5z0t-00063L-9b
	for submit <at> debbugs.gnu.org; Tue, 29 Oct 2024 23:04:51 -0400
Received: from lists.gnu.org ([209.51.188.17]:54918)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dmitry@HIDDEN>) id 1t5z0p-00063D-1C
 for submit <at> debbugs.gnu.org; Tue, 29 Oct 2024 23:04:49 -0400
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 <dmitry@HIDDEN>) id 1t5z0n-0006vf-EF
 for bug-gnu-emacs@HIDDEN; Tue, 29 Oct 2024 23:04:46 -0400
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 <dmitry@HIDDEN>) id 1t5z0j-0000Tc-OJ
 for bug-gnu-emacs@HIDDEN; Tue, 29 Oct 2024 23:04:44 -0400
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 <bug-gnu-emacs@HIDDEN>; Tue, 29 Oct 2024 23:04:40 -0400 (EDT)
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: <xms:SKIhZzpzaXp0buCOTjFZDzxYs8OwGfnzRWmjDG5uUXrF3iEa2AQh8Q>
 <xme:SKIhZ9pH2qm6pjKEmyXCVEmsj9XOa6EYm99gIAoyZYUpvnwRcIyvEdDy_HSxNkwWI
 s-PCfgaeUGJ86NOKj8>
X-ME-Received: <xmr:SKIhZwPM1q6ui-GCifD4SUmf8cJWEZKjJUWmBRZ7eKlzOmO4gnaDw98zNZ6QrUxvOkYb>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdekvddgheegucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu
 rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfg
 fvuffhtgfgsehtkeertddtvdejnecuhfhrohhmpeffmhhithhrhicuifhuthhovhcuoegu
 mhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrthhtvghrnhepkedvveetudekhe
 dugeeffeeugeehtedtveehtddufeeigeffueehteeghedvieetnecuvehluhhsthgvrhfu
 ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrd
 guvghvpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthho
 pegsuhhgqdhgnhhuqdgvmhgrtghssehgnhhurdhorhhg
X-ME-Proxy: <xmx:SKIhZ277Zl73JhPhjdnCwBs2eIH1bpaECTVqbckv-zbQeD9MJJeQQg>
 <xmx:SKIhZy6maSHct7TfzX3BbSRWIinFYmZzW5CkB6wB0-awMd4wzY2ydg>
 <xmx:SKIhZ-ixl7wWfYV1hriN3l4YtuiiNXp2v3iy7d5EIB6td2pfjnQsDA>
 <xmx:SKIhZ07B6jqCc1ktSXwTRKJ_XHxJt6d974_6vtXTPEcXKzWU1w1LRg>
 <xmx:SKIhZ4TGrOWS3DAhEhAfNu-DDZSuIMvREt3wxJOJePMjWRsuvouqSgH3>
Feedback-ID: i07de48aa:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA for
 <bug-gnu-emacs@HIDDEN>; Tue, 29 Oct 2024 23:04:39 -0400 (EDT)
Message-ID: <32a2799c-4161-4b23-8d74-6f072b744f28@HIDDEN>
Date: Wed, 30 Oct 2024 05:04:37 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: bug-gnu-emacs@HIDDEN
Subject: 31.0.50; all-completions is slower on obarrays in emacs-30 than in
 emacs-29
Content-Language: en-US
From: Dmitry Gutov <dmitry@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=103.168.172.145; envelope-from=dmitry@HIDDEN;
 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-Spam-Score: -0.9 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.9 (-)

X-Debbugs-Cc: Mattias EngdegÄrd <mattiase@HIDDEN>

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




Acknowledgement sent to Dmitry Gutov <dmitry@HIDDEN>:
New bug report received and forwarded. Copy sent to mattiase@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to mattiase@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#74097; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.