From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: Advantage using mapc over dolist Date: Wed, 04 Dec 2024 05:33:49 +0100 Message-ID: <877c8gqd76.fsf@web.de> References: <87ed2qpo3o.fsf@gnu.org> <871pyqfl62.fsf@web.de> <87r06por3q.fsf@neko.mail-host-address-is-not-set> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28907"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Heime , help-gnu-emacs@gnu.org To: Tomas Hlavaty Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 04 05:33:42 2024 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 1tIh50-0007K1-Ub for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 04 Dec 2024 05:33:38 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tIh4N-0004kk-FP; Tue, 03 Dec 2024 23:32:59 -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 1tIh4M-0004kX-0P for help-gnu-emacs@gnu.org; Tue, 03 Dec 2024 23:32:58 -0500 Original-Received: from mout.web.de ([212.227.15.3]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tIh4K-0008BC-85 for help-gnu-emacs@gnu.org; Tue, 03 Dec 2024 23:32:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1733286766; x=1733891566; i=michael_heerdegen@web.de; bh=14ph/WvQJs5s4WX6AA0p6sBnaNi+29NnxLldk4dJL/s=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=RvO4iqX2b02w1JI3zed7ZcGHSClqM0gPYXPhUSZWG92w1W1bj+R/+j5a5cYltKnw lMuFzDTZftgUc4ZrwDU78P8yWhF0HbRCskRHYkd3rwWTd3/HhLn55NYyQMhLnAjo4 Y35XB3UHXVRV+COFmV3Q0evjmd679sGs/bp30RBs2I0NqxKrIHq5cnA8YDzwFU0xU 2F3PFi8vFGnO5t7tnnh6yFZrSbDGiyvxBsjDyi82+vi3F9WT5OO9Nj/z1bgBYSgSE Nlwqikhg7v3JFJzQoGlH1WrsGdq7pqt18ikcE+QDYHGctiZ2o4mU20TzhcJH3fbFx 9GUouZ1Q9Ee4P/wVZA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Original-Received: from drachen.dragon ([92.75.138.197]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MvKbd-1tZoJL0un3-00tqOk; Wed, 04 Dec 2024 05:32:46 +0100 In-Reply-To: <87r06por3q.fsf@neko.mail-host-address-is-not-set> (Tomas Hlavaty's message of "Mon, 02 Dec 2024 19:51:53 +0100") X-Provags-ID: V03:K1:56LMjmmAWofvu88bT6fmu7jUgpyjh3tv1Zjk3m5FTmzReYqmoBr xJJPcHIiUN8GAekss+oBwiZHHxBsat4hSGBn7m7lnvrwBhXZZOcNotH7jxNg0TlmejWP44v Yvt/bwt+zjaaDj0hzPm54XjPL3q9us858Njpg9agtmd7tTRnal54MhO0fTJAzp/BBMGz1H3 Lnvd8ZAcsCZt+ToOyY6Pw== UI-OutboundReport: notjunk:1;M01:P0:CF3NOty+4+Q=;LZBU5/7f6WWDyZJRiTuMs6cyr03 LOcU2gn6S/rogTCGYWv2Delg7m25/BJRLQgcylpzz8KNiDVVh7AE1mKSaQsegyoPqFCZJ28g5 ijcdBMAVRNg2tTkBSl592+T2ZnuondT22zbECiceN18pmI4YGVo4aYswxEk3YBkLVsPErYeWE E7PUrm58NXW1+Tbczd73qs7pdyP9XO3rBS/e3n/uXf96yln4VRdPnPU8H/62+1ig8/ALW95b5 sIISkb8U0S/dfwwnRfLNG3KLUk1aGhIz5c9zlN8kjfGjZ6RpsYentvM2N7qcWUP0cbxy06qwJ 3VF2SEMprig0umU4NSgWI2ZmYfzHiV+0aKjlHaDhtMmyN5vFV2NefOaBwN6IqHb4+wiPZc7RS oEz1ZBWOg9lPrw7m5ojEkoag2okz45rRa7RjbMPBJvvT7EXA8tPNKXM0g3O/CLsZHDHJLWcl+ 9arDQvGC0ug1XQYfG88ndIHitmZx6FZmTOqzwmMKGOKl2DK3y1BvZd9/060+WNhc9PXE5Y3xV CWSl19HilEiKPthLxrlYjzB9wPhJi3x2RH86AIP8qXtqEP72Qzs7xysiJwmqfI5KQUTxF51LK Bq8iQVY8Yg9SzbB8Ba2pb4+JxaCuO9xv8oJN0GfTf1oSoH+qfLFlBq620OTF/jZL9ez1WubmI GHIhVgPMNeCVu7cCZCdMW4PsSRVtcAdSExPJDALjpiBJCTLRsBQzQPR7n1sIs23UFBTAmWJmG G70dT3J/UMD8U372ozB7f6Yf0iOFxPeeJar5/jzlK9uMTrXHhzJ51+VypQF/TNW9GAb1pQIu Received-SPF: pass client-ip=212.227.15.3; envelope-from=michael_heerdegen@web.de; helo=mout.web.de 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, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=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: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:148584 Archived-At: Tomas Hlavaty writes: > > Had thought the mapc would be faster. > > mapc calls a function (length list) times, so unless the compiler is > clever enough to optimize this call away, it will be "slower" Of course the same argument would hold for `dolist'. You can rewrite any `dolist' expression to an equivalent `mapc' call and vice versa. Which one is faster can only be explained by looking at the implementation of the language. In case of Emacs Lisp, `while' loops are the most efficient way of looping, and `dolist' expands to `while'. It could be the other way round for a different Emacs Lisp compiler. Michael.