From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Bj=C3=B6rn_Lindqvist?= Newsgroups: gmane.emacs.devel Subject: Re: master b0ba0d42b0f: * src/lisp.h (EQ): Improve generated code. Date: Fri, 29 Nov 2024 02:10:37 +0100 Message-ID: References: <173279015204.1017853.4020802222494409378@vcs3.savannah.gnu.org> <20241128103552.86CC34F4FDB@vcs3.savannah.gnu.org> <8BCABD6D-6605-438C-A62D-B7DA42D07AD4@gmail.com> 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="33449"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Pip Cet , Andrea Corallo , Emacs Devel To: =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 29 02:11:49 2024 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 1tGpXx-0008YU-EW for ged-emacs-devel@m.gmane-mx.org; Fri, 29 Nov 2024 02:11:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGpX5-0002T1-4j; Thu, 28 Nov 2024 20:10:55 -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 1tGpX3-0002Sn-Ee for emacs-devel@gnu.org; Thu, 28 Nov 2024 20:10:53 -0500 Original-Received: from mail-vs1-xe32.google.com ([2607:f8b0:4864:20::e32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tGpX1-0001gr-OQ; Thu, 28 Nov 2024 20:10:52 -0500 Original-Received: by mail-vs1-xe32.google.com with SMTP id ada2fe7eead31-4af4575ec4cso418261137.2; Thu, 28 Nov 2024 17:10:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732842650; x=1733447450; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=t3Ydhv8O4Aul98EMffeqWHLKtuPOyiTNZj0nXM6jzxE=; b=eHo3YvsCIll3IINuHrTHELr347F91PO5YEzSAOUmQvuoORJ+xXwOdE2mqbGMDxsouY ecARxCWBslwlQ2S4T/u4sE4k+QymPS0WfuMbKnnGQeRT/jELh/jx/Lypx0wZoDTChgYy rdjT94F3LwSeAH23G4/mLvqtttcqcdhkT2RSR3m7ykDo2tlDoM/76IKi+p6Pd44oVGyC rzjiW0TQK6UoFUjledvzeleYh5oNRSe9PeuBrHsHlyIJjl56lpNOTnm28FqyPXAOzwbR 6ufQZXTW0fkLHUjqouFV9/5bCOQmPwmJEjDkv7AM+pcx7cE0qOQzGzA2C+/sB3A2pbhx yphQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732842650; x=1733447450; h=content-transfer-encoding:cc: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=t3Ydhv8O4Aul98EMffeqWHLKtuPOyiTNZj0nXM6jzxE=; b=P8lTF4wXyaikwE05IauxiKICNeUihPB3YX9QoTk0+IEen6GnYhTEN4N01xDNjnyX4j tsInXcdgBJAFQrGB5653B3FI5KTx92mtpNb/15T/Psh4NbWHevsMnyAeoV+CSb7gMwR3 irYSlZo2r3BnSB6p4mRNJaSDk3NXbpnFre7+f9deI9ioPxWsjEeETBiJ1bAVntfkjtTh jauKlafbizkg1bCJKARVC7nq0fmbbKiLlgcL85V4Y1aBd6ciYsEhux4c8dOXZrU4lF9X dmn8cJx+NM/cYypBVrYugG8oIoQh2evR8mDLQltIz9ukWx9B9+xCYxt4Zoi5Nxdpgl7Q TOEA== X-Forwarded-Encrypted: i=1; AJvYcCWxA9T/ociiALE1vCZwc71v10qjXQGJNbX/+U2GIQgGFPm5fo6cLLFD7CTRDTAGNESdpRrMLYdTtg==@gnu.org, AJvYcCXmsGPP9Dxk5Gy7bZm6yJSTECmVeuvkzRxCOOKVxjI7/9gVMUgjI9NwAeg+AK4f3qlQoq4zZ0xbi6rVRvw=@gnu.org X-Gm-Message-State: AOJu0Yy3BZycZ/VzgRNKwTPi5x8PeLpAcpAeOhwc/mL0hV6HLcnqkdLC KYojJQf2FlNn9zFEhrtHXBp+dcyR8ajzaQYjzNB31OloLgPKh7QraMJ+wPW2w9FdKIOzsmUBnOd NcJgAwDCN1nV8dJX9Lg/9yJ9tH2M= X-Gm-Gg: ASbGncsBZ5JItTp0NKMYyHEMyfJkhGHTWjOAbfGRNvVUR8f5yYINgr4rFO0cgjd6Qly 5GwAEYsg4H7OCKktKYcuC1X5qk8s0Grs= X-Google-Smtp-Source: AGHT+IFKVpCsb6/lDBRpv4uQq36qfrDkjlhMEV3JXF2N0NCVZk2pB80ffEKayD8F2eUUJe+idazYIm+TMl9Jzw+4Eco= X-Received: by 2002:a05:6102:160c:b0:4af:5f65:4fd3 with SMTP id ada2fe7eead31-4af5f654ffbmr3669568137.6.1732842649789; Thu, 28 Nov 2024 17:10:49 -0800 (PST) In-Reply-To: <8BCABD6D-6605-438C-A62D-B7DA42D07AD4@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::e32; envelope-from=bjourne@gmail.com; helo=mail-vs1-xe32.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: 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:325837 Archived-At: Den tors 28 nov. 2024 kl 18:54 skrev Mattias Engdeg=C3=A5rd : > > 28 nov. 2024 kl. 14.53 skrev Pip Cet via Emacs development discussions. <= emacs-devel@gnu.org>: > > > Maybe we should use __builtin_expect_with_probability instead, in those= rare cases when we are certain we're making a correct prediction? Or, my p= reference, avoid using __builtin_expect entirely, so our scarce resources c= an be spent on more important issues? > > Actually __builtin_expect can definitely provide a measurable performance= improvement, mainly for BB ordering and cold-path moving as suggested by A= ndrea's commit note. I've been thinking about using it in other cases. It can also worsen performance if one is not careful. Micro optimization is very often very counter-intuitive so relying on theoretical improvements is often not advisable. Especially not for code that should run efficiently on dozens of different platforms years into the future. --=20 mvh/best regards Bj=C3=B6rn Lindqvist