From unknown Fri Jun 20 07:19:48 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#65988 <65988@debbugs.gnu.org> To: bug#65988 <65988@debbugs.gnu.org> Subject: Status: 30.0.50; Emacs and -O3 compiler optimization Reply-To: bug#65988 <65988@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:19:48 +0000 retitle 65988 30.0.50; Emacs and -O3 compiler optimization reassign 65988 emacs submitter 65988 Arash Esbati severity 65988 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 15 05:23:34 2023 Received: (at submit) by debbugs.gnu.org; 15 Sep 2023 09:23:34 +0000 Received: from localhost ([127.0.0.1]:42056 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh530-0001jf-6Y for submit@debbugs.gnu.org; Fri, 15 Sep 2023 05:23:34 -0400 Received: from lists.gnu.org ([2001:470:142::17]:41400) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh52w-0001jM-Pk for submit@debbugs.gnu.org; Fri, 15 Sep 2023 05:23:33 -0400 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 1qh52j-00007Q-0I for bug-gnu-emacs@gnu.org; Fri, 15 Sep 2023 05:23:17 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qh52i-0004zq-NH for bug-gnu-emacs@gnu.org; Fri, 15 Sep 2023 05:23:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=Tk26HuZvQcECfxPQjVeFpBhyImSqJ7QbxgsUE9L/iw0=; b=NmdF/CHcvi7vtD NNJFo4A0MIK6exh6tRd5wDLm+mmFBl2IBJPoBw3qVFax39Lmj/RyHGVF6o5l60gvoKQKMQWYMHaU3 aKakBVWY1VlOPxPnXcj8uWn2m1Vo6dwlStjW+ENwEvdxqWoQ0sVYNo/VPmkTCyBLhewnMcy5K8oGS L+rR/MqwO6bE4wwNfwnRbDYETcz7wTE20ZzTORkjM6/mPKo8jylrSy9VGCU+YCVDY+OV+wXCJpN1E r/3pCXram8HLl4m+oMGXGNnbgKn50o41X29vTnnbk4oVIaxk1c9h4JfwAUV96NkTC3+Vuf0vWi7tk dPl690LZGzgigYLIU8FA==; From: Arash Esbati To: emacs-bugs Subject: 30.0.50; Emacs and -O3 compiler optimization Date: Fri, 15 Sep 2023 11:22:36 +0200 Message-ID: <86bke36bab.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi all, in this message[1], Eli explained why the -O3 optimization switch isn't recommended when building Emacs: In a nutshell, it bloats the code (due to excessive inlining), with no real effect on speed. The inner loops in Emacs are very large, and thus the techniques used by -O3 to speed up code (loop unrolling etc.) don't really work. Moreover, they could make things worse because the larger loops might no longer fit into the L1 cache of the CPU. The -O3 is well suited to speed up relatively simple algorithms with tight loops. Emacs has very few of those, in the places that matter for observable performance. Presuming that the note above applies to GCC on all platforms, I suggest to change/adjust the following example in INSTALL[2]: Here's an example of a 'configure' invocation, assuming a Bourne-like shell such as Bash, which uses these variables: ./configure \ CPPFLAGS='-I/foo/myinclude' LDFLAGS='-L/bar/mylib' \ CFLAGS='-O3' LIBS='-lfoo -lbar' (this is all one shell command). This tells 'configure' to instruct the preprocessor to look in the '/foo/myinclude' directory for header files (in addition to the standard directories), instruct the linker to look in '/bar/mylib' for libraries, pass the -O3 optimization switch to the compiler, and link against libfoo and libbar libraries in addition to the standard ones. IIRC this was the place where I picked up the -O3 switch for the script I wrote for building Emacs. Best, Arash Footnotes: [1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-06/msg01274.html [2] http://git.savannah.gnu.org/cgit/emacs.git/tree/INSTALL#n493 From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 15 06:49:37 2023 Received: (at control) by debbugs.gnu.org; 15 Sep 2023 10:49:37 +0000 Received: from localhost ([127.0.0.1]:42194 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh6OG-0004FY-U5 for submit@debbugs.gnu.org; Fri, 15 Sep 2023 06:49:37 -0400 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]:59392) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh6OE-0004FK-M6 for control@debbugs.gnu.org; Fri, 15 Sep 2023 06:49:35 -0400 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2bfcc35ef7bso24974801fa.2 for ; Fri, 15 Sep 2023 03:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694774962; x=1695379762; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=VTUJWfT2w0AjGGtvPodCD7akDuD57Viw0wnp3CpBWY4=; b=CMGmwRF2PwJC+hzCYX3rruslXwKzzfbqrhzmiqYdoBQbOzaZXudthec2i+fFKUyuin YiUe0Ps0Em9dgXhLP8zS2bvdHJqO9O4MLEzgpfRdeGPpCF/jDVC3CxSTR0mnKiJARYla 92sirkXLMjBs3U/x4TNRwM1CqB0J/XwLgO1kr0jyEnC9Y/ERgbMvtgPUzlP6UR2uE1oo 4q1cfNFNoTjRI0fnpPATRA6NS0gE2e+yRYDteW1o1bz2YxvCcw4z5lJEwwj4rLfSRm61 KKKADyoMbTkJ1I5qZ04iWnAFUqXnnHEcsUlYpW1mJtFVjIY2DJRod+S76PX3J/FZuQNN 8xgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694774962; x=1695379762; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=VTUJWfT2w0AjGGtvPodCD7akDuD57Viw0wnp3CpBWY4=; b=Xe1aBeDTouxyqICzTsOU9toifBjVl0u628hj0zLG++V8LGRIOl82X57CmaG16jfJGa A71et6fcn0OyGXGy9mwjizRX4PAxS6wS9m6EnfhPWNbP6f72NTOVMeqc01ZBQIY9ENYC c+6kpJXsp70U8SO6mxWg/F+zMwg3KX1Y9y3X5SvTTRrJs/Mw0sDWXa5Kck/jkpaHF7yD b5lCij+t90I+O8Yheg+Cst0yzZWhVPCdaCy3LVdSfMMcIhSy14Ry88dU/gdy80QZAZau ZZXC6ZicwFvlo4zvV9ZLFcsu3jAGJx6ahRV6oWcTPoeypS/LN4zNQzjCPVwakSGOpP4b LrbA== X-Gm-Message-State: AOJu0Yy0VGJehpyESc2G+/sC2nXcdDN2VZuF+qkFXwSUxkJFWbv7Nhk2 9MvQh705f06rTSdC1EvaE4Oe/Q3AimBRI3vbb8gTSslB X-Google-Smtp-Source: AGHT+IEZFcQ55InsGP9tNEW834jfYp/74W6kkYVRWCjA8+p2gWPOSuzKMo2euqsBAKBS7zxtUrflwuztHh10Gxf6kAY= X-Received: by 2002:a2e:9b52:0:b0:2bc:c557:848a with SMTP id o18-20020a2e9b52000000b002bcc557848amr1135621ljj.50.1694774962176; Fri, 15 Sep 2023 03:49:22 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 15 Sep 2023 03:49:21 -0700 From: Stefan Kangas MIME-Version: 1.0 Date: Fri, 15 Sep 2023 03:49:21 -0700 Message-ID: Subject: control message for bug #65988 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) severity 65988 wishlist quit From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 15 07:30:03 2023 Received: (at 65988-done) by debbugs.gnu.org; 15 Sep 2023 11:30:03 +0000 Received: from localhost ([127.0.0.1]:42266 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh71O-00080v-L7 for submit@debbugs.gnu.org; Fri, 15 Sep 2023 07:30:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh71L-0007zp-HN for 65988-done@debbugs.gnu.org; Fri, 15 Sep 2023 07:30:01 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qh719-00008e-MD for 65988-done@debbugs.gnu.org; Fri, 15 Sep 2023 07:29:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=tfIBVrnKrAda/Z/4fLrIPHniIy6ABlW6HtaCVxFLOBo=; b=F/H6r5btjcGd hDEN1xE1qKEiE0D9p7FLPW8mjjyqsqJ7ofHXKjfZYp6PzGrpfj37YfjUOKlWVa8o+XGDIEQctDC0B sDXq3+yBIPdsHIhGFy8ereG7NK6BQcuePh9SBqIO7Aq2zMVsX/Cjolk43oEeO0H2TGlcdGN2+Q4ft yv8SbY3SfmNxF9a4wENmS/J6/juDiZu+Ivu/Ddl7Pfby7o9eoRo3wqJMaJbrKwtEs/ZwNWm79UFcS nTolohWgXbJlOBMXoX9W5vZXggxl+F5KxJymNOFSztBIihEzk+o0oqSYdS0ikTfmzkEikuiUkKBA1 H/bCeSFiQfxzGJJvZpWtgA==; Date: Fri, 15 Sep 2023 14:29:38 +0300 Message-Id: <83o7i3k731.fsf@gnu.org> From: Eli Zaretskii To: Arash Esbati In-Reply-To: <86bke36bab.fsf@gnu.org> (message from Arash Esbati on Fri, 15 Sep 2023 11:22:36 +0200) Subject: Re: bug#65988: 30.0.50; Emacs and -O3 compiler optimization References: <86bke36bab.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65988-done Cc: 65988-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Arash Esbati > Date: Fri, 15 Sep 2023 11:22:36 +0200 > > Presuming that the note above applies to GCC on all platforms, I suggest > to change/adjust the following example in INSTALL[2]: > > Here's an example of a 'configure' invocation, assuming a Bourne-like > shell such as Bash, which uses these variables: > > ./configure \ > CPPFLAGS='-I/foo/myinclude' LDFLAGS='-L/bar/mylib' \ > CFLAGS='-O3' LIBS='-lfoo -lbar' > > (this is all one shell command). This tells 'configure' to instruct the > preprocessor to look in the '/foo/myinclude' directory for header > files (in addition to the standard directories), instruct the linker > to look in '/bar/mylib' for libraries, pass the -O3 optimization > switch to the compiler, and link against libfoo and libbar > libraries in addition to the standard ones. > > IIRC this was the place where I picked up the -O3 switch for the script > I wrote for building Emacs. You really shouldn't treat what's in INSTALL so literally: it's just an example to illustrate how to use these switches. I changed it not to use -O3. From unknown Fri Jun 20 07:19:48 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 14 Oct 2023 11:24:12 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator