From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: (*) -> 1 Date: Thu, 19 Jan 2023 16:41:51 +0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11982"; mail-complaints-to="usenet@ciao.gmane.io" To: Drew Adams , "tomas@tuxteam.de" , "help-gnu-emacs@gnu.org" , Paul Eggert Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 19 11:21:55 2023 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 1pIS3O-0002tT-V6 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 19 Jan 2023 11:21:54 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIRQw-0002HD-GK; Thu, 19 Jan 2023 04:42:10 -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 1pIRQu-0002Du-T2 for help-gnu-emacs@gnu.org; Thu, 19 Jan 2023 04:42:08 -0500 Original-Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pIRQt-00013H-7K for help-gnu-emacs@gnu.org; Thu, 19 Jan 2023 04:42:08 -0500 Original-Received: by mail-wr1-x436.google.com with SMTP id e3so1221235wru.13 for ; Thu, 19 Jan 2023 01:42:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=sPQ5OAfYlhV4X/L7pq5gXWgX5dqsz5OOwDkNCmHIozQ=; b=X0TqMetYNBPYmsv1H6pemXSRpKw0G0w0yRDnHjeAGj1LO1r6FUSFgB/pbu/ZSwxrnd UxgzbeoIjqam5uyP1ibMIKFAfWEC7Rlr7xJ0EXt2IlQGjCd5ulS9p/nMtPIBroJeulds 3vf5fWeOJn0RUp0Gv4Oa1uZHdfdFkpo9rffzVfwJnV/bThLRtetpf0FB46vPxD38Ofb1 RnvG78u/ZIzzhvlS5uzxv6X7uO4i4ErqBaeZCzBoPyvZjQ9+rNqF0rUFjE2QCCjCvOr4 qFEWk6S6akHLy2ipAxnISWL76YWGleQBrGyNdymtkx4TOqzMzDPMtVIfucpI58qlxn4X sbSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sPQ5OAfYlhV4X/L7pq5gXWgX5dqsz5OOwDkNCmHIozQ=; b=yoLtVtajw4JoN8+m4gFzuKsLGW9Qxkti6UH/wrtNhngtfhiuEl/8zkrAEm87ER6Rpl Rj3QWplKZgHv36Csr3U0exOuBkLolgUJMzsgBN5zpOmbVLxgbUyQ2/knm3yN7oPEtYVy qjAhZcy2XbIds7TJikcVOrKcHeo8B1dx7LdgdKswmfJg4pT+IcKMGt80XSp1guCuZAD0 sm480XoWbjzfuH2QZANWuIFqh5Lqz5K5wzsjhF9ZZq83ZP0RtW8PntktihedWHMOUXYI GVrq7UL8s1thvxaoRTqXZdAGVqJCVpZRplcJmmgMGd0to6C076OkQeb0Mx2mTzQMrRPB XeDA== X-Gm-Message-State: AFqh2kq+ldd7M96BBzIKpBM97hGMNlBmjPf07E28MxLToD2TAb+XkwPO Gz4YNr/3ZVW2laohOBOj9JdJVljlA/LVq+GwH1E= X-Google-Smtp-Source: AMrXdXv4EJ8pDn3ia6Ls185u9bVbCDXM3fRBeCO+tGKsVZrpmnNUEmMxg7l8mUz6eRsM971RRAcf8hpdv49th0oRxO8= X-Received: by 2002:a5d:6f01:0:b0:2bd:dbfe:8fa1 with SMTP id ay1-20020a5d6f01000000b002bddbfe8fa1mr394102wrb.332.1674121323273; Thu, 19 Jan 2023 01:42:03 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=yurivkhan@gmail.com; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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:142390 Archived-At: On Thu, 19 Jan 2023 at 16:18, Jean Louis wrote: > Then I look at the first time it appeared in Emacs: > https://github.com/emacs-mirror/emacs/blob/fe042e9d15da7863b5beb4c2cc326a= 62d2c7fccb/src/data.c > > Improve arithmetic performance by avoiding bignums until needed. > (floatop_arith_driver, arith_driver): > Simplify by assuming NARGS is at least 2. > All callers changed. > As I cannot decipher above, does that mean that (*) =E2=9E=9C 1 was added= only > for reason to speed up some C functions in Emacs? I understand the above as =E2=80=9Cbefore, calculation of 0- and 1-argument sums and products was handled by the generic implementations in floatop_arith_driver and arith_driver, but it turned out that detecting those cases early is cheaper=E2=80=9D. If you read the version of arith_driver prior to this change, you will see the initialization of the accum variable with an identity value according to the operation, and then doing the binary operation on accum and each successive argument and storing the intermediate result back into accum. The actual logic of (+) and (*) for 0- and 1-argument cases did not change in that commit. You will have to dig deeper into the history if you want to find who introduced it first.