From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Re: Testing whether a list contains at least one non-nil element Date: Tue, 25 Oct 2022 22:08:29 +0200 Message-ID: <87y1t3fykm.fsf@fastmail.fm> References: <87r0yvst2a.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12987"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.3; emacs 28.1.91 Cc: help-gnu-emacs@gnu.org To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 25 22:17:55 2022 Return-path: Envelope-to: geh-help-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 1onQMy-0002xx-Gy for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 25 Oct 2022 22:17:54 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1onQMI-00012S-Dk; Tue, 25 Oct 2022 16:17:10 -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 1onQME-0000LJ-El for help-gnu-emacs@gnu.org; Tue, 25 Oct 2022 16:17:07 -0400 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 1onQMB-0003sP-T8 for help-gnu-emacs@gnu.org; Tue, 25 Oct 2022 16:17:06 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id B9F823200905; Tue, 25 Oct 2022 16:17:00 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 25 Oct 2022 16:17:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc: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=fm3; t=1666729020; x=1666815420; bh=UpaI+JmgfE x4GxjfbpNzFO1Me2I1S6sWZNu5mNyTEZw=; b=Z0RwdOYWWN0n558vBxc5whcaVL YN2osUOC7iOXyEwTlvjVclFqQlL9IzZt47pEmakPaox7nehwvhIX3ytwef0kfKME VyQ/92dRyq2XD7H07m09lgq8bWlTc+Ui6tMsGCwoeFEVvYbrCSqgA6XftmxRWaZe +lYeo3NAHst6r1EylV8GfydRH6s/UJLWi/3juQ2lLjYuQQ2y64iQhUdgtu01WCQH P77y5OANC8I4AWS/7yRm8b1z/F7I2P9bo+3kEd6teTO3XpP504PqhhA7R0KcERq4 Ev7GXa+uMnUlB+QBu8ZZqPy36C0m+0P8N8uPCLd2aALq523HW8rsMn8iUlZg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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=1666729020; x=1666815420; bh=UpaI+JmgfEx4GxjfbpNzFO1Me2I1 S6sWZNu5mNyTEZw=; b=b0U5S7vbXwklzP8n3q+N0yv3Y5DzUbywkVXNl09HrA/s Az2MxgYdmqds6M6N7KTWuBd7PLnszM4FhsiYrJeKYRi4N0189XgmVMv3ZkdrvmX2 fR6zFwVqBsuCMuVFsSF+etTYTEHlbPIaq7dJtALEfZIXMuNCKqPAQE+Ps84od/KA f4gZflk61rwsBCMf8TDK3Hs6c/H74jcSgFrD7ZLYeHaD6UAq2GQ5i0v5DN/SmBut N7/85JumnQaRGl+XgubBl2NmtFQG62UU4Tlw4edlG6z6O3xHEoQFtrfZC9em7/Kd 2oiHHVHxfieWQ20Js3+C5gEym798hDFaQWZpl+srcQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrtddtgdduudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpehffgfhvfevufffjgfkgggtsehttd ertddtredtnecuhfhrohhmpeflohhoshhtucfmrhgvmhgvrhhsuceojhhoohhsthhkrhgv mhgvrhhssehfrghsthhmrghilhdrfhhmqeenucggtffrrghtthgvrhhnpefgiefhuddtte eljeehveekjedtffeuheffhffffeetieetfeehtdektdeitdekffenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjohhoshhtkhhrvghmvghrsh esfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Feedback-ID: ie15541ac:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 25 Oct 2022 16:16:59 -0400 (EDT) In-reply-to: Received-SPF: pass client-ip=64.147.123.19; envelope-from=joostkremers@fastmail.fm; 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "help-gnu-emacs" Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:140381 Archived-At: On Tue, Oct 25 2022, Heime wrote: > On Tuesday, October 25th, 2022 at 5:25 PM, Joost Kremers > wrote: >> (not (seq-every-p #'null mylist)) > > How does your implementation (not (seq-every-p #'null mylist)) compared to > > (elt (delq nil mylist) 0) Not well, it seems: ``` (setq mylist '(nil nil nil nil nil nil nil nil nil t)) (benchmark 100000 '(elt (delq nil mylist) 0)) "Elapsed time: 0.040299s" (benchmark 100000 '(not (seq-every-p #'null mylist))) "Elapsed time: 0.470680s (0.187590s in 1 GCs)" (setq mylist '(nil t nil nil nil nil nil nil nil nil t)) (benchmark 100000 '(elt (delq nil mylist) 0)) "Elapsed time: 0.035235s" (benchmark 100000 '(not (seq-every-p #'null mylist))) "Elapsed time: 0.361699s (0.186059s in 1 GCs)" ``` `elt` and `delq` are both implemented in C, while `seq-every-p` is a generic function, so I guess those results aren't surprising. -- Joost Kremers Life has its moments