Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119336 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 10681 invoked from network); 18 Jan 2023 20:37:59 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Jan 2023 20:37:59 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F2AE518050B for ; Wed, 18 Jan 2023 12:37:58 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 18 Jan 2023 12:37:55 -0800 (PST) Received: by mail-oi1-f182.google.com with SMTP id j130so5649oif.4 for ; Wed, 18 Jan 2023 12:37:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Zih8vvbLOSEIijDEdrAWBYm5l0kcJIybRmk3xTXxxys=; b=nXco46gkgl8J6N0IrLXSBRuH8NnW/5/wzDUysqufkOmD5av+wm9NBIPhN15XvLQ8+v 5QbqxWuXHT7r16Fsd6WRrY5DOMez9ImRcrixd8dqIQTY/T/P1J9hNZgvWVG/cd0hr79h GgEdE1aZnhfCnt4EXNOKO7fxHjLi4Jnd5XRaQxfMl23/AIZJ8fkQ07kNyBMfwEgW/sEV XcMWdFRrVWMMHyFiPkN3iToVX1oxlyh1Dyu7yQpHANtR7AnY4yQN0xv0rK2xsVY4GCe5 GNBMnEIVsNhqLhV786oTDGz4c8lgKUf6EzhydpltszBTh0KtFIyZ0ONdnXOkKnWXl9G+ WOWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=Zih8vvbLOSEIijDEdrAWBYm5l0kcJIybRmk3xTXxxys=; b=YLN67LEGhoZGNtQCQqk96OIMSpar0MevfJef8uirhr78RW9DIyPLSODrn3MBWQcZNz zSjMMCFlSvPXNl5UoiLBWV7mMtBcMFNfySUuthG5ywo14svbtkCQDiVbNKQv2N3v7G8P l9s/YkWjmFPCrxCGGTlLyBlDrY2wCR0X9BNVhdkTgIkput0imbbGODl9gVjFzqDaQDtA xQgPHFZAGjYhAIZWB0gTXKvzN6XMPJjUMe2vw/Lm8KJY+2rQqtNGzlV+rw31arbbO1cq apuxJ3ML2bML2PmuFI81w442HA9TF987RtsMeOSJ037DrcO5bRSV9bP01QWMJVpMkTGT ezIA== X-Gm-Message-State: AFqh2kryaVVo6FkiY/LD18SdDf5rJXqebL8BcNWaMADkQFykP3GJbE92 Px26OFSoi1S8AOr91AEdrcT8U4W2PftokWD9pMg9Urrh X-Google-Smtp-Source: AMrXdXuz6lHOvw9BLrBx5l3hYbKfS7w8ZizQ/x6NliLbo7fZvug+lgOcaMuQaAt8Xso8gYXymjV4eYI1JYurihtnS7k= X-Received: by 2002:aca:1c0e:0:b0:35b:fe2a:a93b with SMTP id c14-20020aca1c0e000000b0035bfe2aa93bmr507186oic.60.1674074274636; Wed, 18 Jan 2023 12:37:54 -0800 (PST) MIME-Version: 1.0 References: <8DA390C5-5E67-4847-A89F-1A8CCC6C5389@gmail.com> <419f4c45-8171-1051-8956-175283fb6669@bastelstu.be> In-Reply-To: <419f4c45-8171-1051-8956-175283fb6669@bastelstu.be> Date: Wed, 18 Jan 2023 17:37:43 -0300 Message-ID: To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="00000000000077a7fa05f28fca55" Subject: Re: [PHP-DEV] RFC: rules for #include directives From: flaviohbatista@gmail.com (=?UTF-8?Q?Fl=C3=A1vio_Heleno?=) --00000000000077a7fa05f28fca55 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 18, 2023 at 4:17 PM Tim D=C3=BCsterhus wrote= : > Hi > > On 1/18/23 18:51, Kamil Tekiela wrote: > > As you said yourself, this refactoring has no practical effect on > > It has no practical effect *yet*. The headers need to be untangled first > before actual optimization can happen. > > Or maybe have all > > ZEND headers included with a single header? > > That would go against the goal of reducing compile times. Much of the > time spent when compiling C is parsing megabytes of source code, because > deeply nested and/or unnecessary includes will bloat the amount of code > the toolchain will need to go through. > > Let me give a simple example: > > We have the following headers: > > a.h: 1 MB. > b.h: Includes a.h and is itself 100 kB in size. > c.h: Includes a.h and is itself 100 kB in size. > > foo.c: Includes b.h and c.h, but c.h is not actually used. Is itself 300 > kB in size. > > Now when compiling foo.c, a total of 2.5 MB of source code need to be > parsed, because a.h is included twice. If the unused include for c.h is > removed, then it will only be 1.4 MB in total. This multiplies quickly > for more complex include chains. I'd like to point to this commit once > more: > > > https://github.com/haproxy/haproxy/commit/340ef2502eae2a37781e460d3590982= c0e437fbd > > Removing two headers in a single file reduced the total compile by > roughly 10%! > > Here's two more similar commits: > > > https://github.com/haproxy/haproxy/commit/e5983ffb3adbf71a8f286094b1c1afc= e6061d1f3 > > https://github.com/haproxy/haproxy/commit/1db546eecd3982ffc1ea92c2f542a3b= 01ce43137 > > Best regards > Tim D=C3=BCsterhus > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > Tim, This may be a silly question, but in that case, wouldn't #ifdef guards keep the compiler from including/parsing a.h twice? When a.h is *not* required by any of b.h, c.h nor foo.c, I agree that it should *not* be included at all, but when any of them, or even if all of them requires it, the guards should be enough to avoid redundant work afaik. Or am I missing anything here? --00000000000077a7fa05f28fca55--