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: What's missing in ELisp that makes people want to use cl-lib? Date: Mon, 13 Nov 2023 02:25:02 +0200 Message-ID: <9ab5d2bd-a648-cae0-a4a7-ae86be10af0f@gutov.dev> References: <87il6bt4z0.fsf@yahoo.com> <8734xetjkk.fsf@yahoo.com> <87cywhsrcf.fsf@yahoo.com> <87cywgx1z0.fsf@web.de> <83wmuowwp3.fsf@gnu.org> <8334xcwank.fsf@gnu.org> <320999cc-6c83-2315-0044-cc0403400af3@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="37429"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: =?UTF-8?Q?Gerd_M=c3=b6llmann?= , Eli Zaretskii , michael_heerdegen@web.de, emacs-devel@gnu.org To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 13 01:26:12 2023 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 1r2KmJ-0009U5-56 for ged-emacs-devel@m.gmane-mx.org; Mon, 13 Nov 2023 01:26:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2KlS-0006lE-8C; Sun, 12 Nov 2023 19:25: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 1r2KlP-0006l5-D4 for emacs-devel@gnu.org; Sun, 12 Nov 2023 19:25:15 -0500 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r2KlJ-0001Mq-Rp; Sun, 12 Nov 2023 19:25:13 -0500 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id CCD253200645; Sun, 12 Nov 2023 19:25:06 -0500 (EST) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sun, 12 Nov 2023 19:25:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :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:sender:subject:subject:to:to; s=fm2; t= 1699835106; x=1699921506; bh=Wz98djU03GkmfmbUM9Z0wh9/WWqayPO8Dgp wAfaSGN0=; b=B6Y2IqaO3r9mygA3DUvYajcd+dynM7wC3gAwgl2NcyfSL9Iw36+ A0Q2n4LMiCYekI08gGM1vwss4rZSZvGpoSqF2Tx9Rupq/b1LPFKtkwBsz9fHfCPF Vlya7hdeHw9dilfajKoOOO6o8bBm1ybM7CrT8uBVJzLlPa1vlgpGkGUUNR8NqWdw qPqDh/MJrXsOXi9PaoFkBwi+9Qpbiv8WGPlQdOyqpYdAdqJCASdnQWnhrZYM22Kb 3yYMiwMEh+PSnXBodjo0hpSVR6oezDHYoJOmJ83PNhGsDjLOhjTYi1fIYziJrEd5 aYnyfJEXH/AUOMno92+znsGCU4kN/CUE5Nw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1699835106; x=1699921506; bh=Wz98djU03GkmfmbUM9Z0wh9/WWqayPO8Dgp wAfaSGN0=; b=Qk0eAyI7D2NvMSBprO8CQDZyctRJSyr0qVF/KQq2PtVF9b4AWz2 22AhfrdgcBuQGh6v9RkD7vO0zoF/0Ljx51jPzQJFFOPSMNvZvVmfz0AeNuG8TrfW igmPKfBPDQC8PtX4hYXMVBZV5D4zg5pJ3L+pB5OOVOOXGIA5okgVQp5mo15QmiYO O1SRm9esOmoyY2TLNNFyWpVA6xy+E7AYSGDb8dlLXxooDlNZl4lWDhK8U80ML0Jz ZoBCupBmV0IqKX8rZ95Z1WxNWcLKwyRyGIiB+4Qy1mzSx3OPEl+xHlK1A+BYe5Yr sppdHwEJwCosxIeNovZM2bpLBR+qc4WS+WQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedruddvledgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhephfffheeljeffgeffueeghfekkedtfffgheejvdegjeettdduheeufffggfef jeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 12 Nov 2023 19:25:04 -0500 (EST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=64.147.123.25; envelope-from=dmitry@gutov.dev; helo=wout2-smtp.messagingengine.com X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 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, NICE_REPLY_A=-2.553, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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:312669 Archived-At: On 13/11/2023 01:14, João Távora wrote: > On Sun, Nov 12, 2023 at 10:09 PM Dmitry Gutov wrote: > >> So it seems on par with the hand-written version (byte-compiled, too) >> that hardcodes the test function. >> >> Curiously, though, if I make list2 longer (e.g. 12 elements rather than >> 6), then my/set-difference starts to win noticeably (0.166 vs 0.200). > > I have a suspicion, I'll see what I can do. > > More importantly, there's an important takeaway here. Your > results seem to show that regardless of the alternative (cl-lib > or hand-rolled) the solution with Emacs's current recommended > sequence processing library is nearly 6 times slower in a > real-world use-case. Note that it's still the difference for the case where the "business logic" (the filtering predicate or whatever) doesn't do anything. Although certain order-of-magnitude differences are worrying. > Maybe seq.el can be made faster too? Who knows, but it seems > difficult without breaking at least some of its defgeneric-based > contract. I was wondering whether you tried looking into seq.el's performance problems. It being slower on shorter lists is quite expected: if the type dispatch has non-negligible overhead, that should be most noticeable when the rest of the work is small. The case with longer lists and other data structures should be possible to improve, though. As long as the type dispatch only happens once per sequence, and not for each element. >> I'll keep the real-world case as-is (code in project--vc-list-files) >> both because the result with cl-nset-difference is still a little >> slower, and because it's slower in all released emacsen, but it >> definitely becomes an option. > > Not that I think it's worth it just for this, but isn't cl-lib.el a > :core package? It's not: the version in ELPA is a small backward-compatibility shim for older emacsen.