Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118880 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 15546 invoked from network); 24 Oct 2022 23:44:42 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Oct 2022 23:44:42 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ACA66180054 for ; Mon, 24 Oct 2022 16:44:38 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR 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-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 ; Mon, 24 Oct 2022 16:44:38 -0700 (PDT) Received: by mail-lf1-f50.google.com with SMTP id b1so19194819lfs.7 for ; Mon, 24 Oct 2022 16:44:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=nVq+nEZhnb+WS6oEV5C8yQEenTIzXFSzM5WfPnlYrXU=; b=dza/xI6Zijxnx7KXEjcAP2mQV65dvSkD09cxOqBCX6PyGf8QUSFzbW1kLwXexiiFFy TtezozVMYwHxWcYSSxUZWbJVorz9coLE43b6VsaavFBbtvCdh6LC0/1loAiB4OzNIdRR KhujW3NFJgeXaKi11SfmoDBZRRWJJ5WlaOzng= 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=nVq+nEZhnb+WS6oEV5C8yQEenTIzXFSzM5WfPnlYrXU=; b=Jlp+2N8xXjg46yJO/XBqhUxbUB9PILE2Mm+gJJTeegxc9b9FL1ebNQnCd4Op6+AqP2 mxDkfsIla0QYXpNtiAz9yN0KqjVZ1oUrrPv6Fb2cqyjgf5pm1wWzjxsIR/fmCfgU/skA LC6eMeTz5Mxnh0/i20+V0N7a/QpG3l8M0z3l9+6Vvw/PJgfTt5ErYVi219uFdkhZxvCw dk5Hx/QKGBSzzLKfaIKx894qISLqFNscXVnoqTw13pgyIhF/lIa+gNjeVbmszBIpcLVD zi0PpzQOjeSjGopDHm3zrkHE+PB/M6nT/fGIYh2+WlOZGklTjyzaoPgf34yPVflwzBPr LqJA== X-Gm-Message-State: ACrzQf3Q0mEoNIAEKa/V8wNWk3Jjb3gvmKpugbM4rBqroDQest1Ct6vQ nOgM8uqAbcw9867mV2q2wIR3KP6d0+4J+gJwdyfBH7qjVBN/xg== X-Google-Smtp-Source: AMsMyM7tu5i9X54NnbZglEG58XUZPlsLiF6oYf6joWJ7Xdh0+ktxXhToZZmRPARjbdnadet32AQRdAw/OIXj3/f7ADc= X-Received: by 2002:ac2:4c4d:0:b0:4a2:4a6a:b24e with SMTP id o13-20020ac24c4d000000b004a24a6ab24emr12268015lfk.146.1666655076485; Mon, 24 Oct 2022 16:44:36 -0700 (PDT) MIME-Version: 1.0 References: <50321070-3682-c238-d8b4-3d0f6832c4bc@pouzenc.fr> In-Reply-To: Reply-To: Levi Morrison Date: Mon, 24 Oct 2022 17:44:25 -0600 Message-ID: To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Newcomer, PHP pre-processing, Magic Constants __FILE__ and __LINE__ override with #line like in C From: internals@lists.php.net ("Levi Morrison via internals") > I think you're also greatly over-estimating how large the startup cost is in practice. It's real, certainly, but unless you have several nested microservices a well-made framework should have a fairly small overhead. I want to share my experience that some users have very slow file I/O, and I regularly see `file_exists` and `stat` show up in slow code paths. This is one reason I would like to remove the warning on a failed `include`, because then instead of `if (file_exists($file)) require $file;` or similar, you can just `include $file;` it. When I brought it up last time, some people actually liked that it has warnings so... I didn't move forward. Maybe there's room for `try_include`: [$included, $retval) = try_include($file); if ($included) { // $retval will have the return value of the file } else { // $retval will have a warning/error message you can work with } I like this quite a bit less than changing `include` to not emit a warning, but it's not without merits: 1. `include` still emits a warning, so nobody relying on that will be surprised. 2. User gets to control error handling. 3. Can be polyfilled, it just costs a bit of performance. Anyway, it's a bit off topic, so I'll stop here.