Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127266 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id C0F621A00BC for ; Thu, 1 May 2025 15:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1746114959; bh=BqM1z78GytDvS+yiJkkqW9bZjJew0TZVHheHbMjjmUM=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=QEMsX61nxJvVkQOD5FsJRD/nJC4cX7f23sxekF8Gs8GlDBl5bq+fzwmF0bnl95tmC u2NUqJzsX03WIoVEMFFRA8DYe8OlfjK8PMPu2GIb1x+82X7FS9z2ae1kz8p5N2hGar s6GQ/KAKIPgwsF5RLUehP3D5SQLJQvuSEzUH6XWqa6x6PTMLTXNxHxY/8Dzj4iDJzo O4E30JhXTPhw19QSeu/DWsVd8ipuhIVHUvm+rpDTcSDstZsTV3+GPllWA9Tmx9jdRf wMBrm1YJilQm4/RWC9klPNty6Hxid+MsORUQethzivKUxVlStvQIoyjN47YTD87mPl Wwe933l97W74g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A9F1E180057 for ; Thu, 1 May 2025 15:55:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from premium76-5.web-hosting.com (premium76-5.web-hosting.com [162.213.255.108]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 1 May 2025 15:55:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pmjones.io; s=default; h=To:References:Message-Id:Content-Transfer-Encoding:Cc:Date: In-Reply-To:From:Subject:Mime-Version:Content-Type:Sender:Reply-To:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=12fTnAAij3utzH0431M37eNvJjV02vxHmymyi7QU1mk=; b=lGtF+M8y4tJg680qo77wzN9qH1 YRs8fYe4BMSZOMhfdVcRtDgqo22DtaY4hXCA0HirhTLZFKKMScf6Z77a9H+cAQbkBkj+XGp85O5Ex UA9pikJF/mNQ33djPkAxiPhpB8pWjjKKjDZUhW/mTTuxGRXnh+Qi681Zt1PH9x5gepK1zNfwad7lX twzL7MHKznwhSNc9XSqRKjMxXZ8BEfU+N7yyYIaSPfFLPLqm5AmJmPEUK1PWxYWT+f5rYPEBmt1xd CnxFndx8dCGRYLN7aQbIATapMiD1KjcFNmP1SBhKhqyDXcVgmB/rGHH6kUiaWCOtJOfSs+XsEBDgS 78yKVbOA==; Received: from 107-223-28-39.lightspeed.nsvltn.sbcglobal.net ([107.223.28.39]:62540 helo=smtpclient.apple) by premium76.web-hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1uAWId-0000000AR8X-2Nvc; Thu, 01 May 2025 11:58:11 -0400 Content-Type: text/plain; charset=utf-8 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.400.131.1.6\)) Subject: Re: [PHP-DEV] Concept: Lightweight error channels In-Reply-To: Date: Thu, 1 May 2025 10:57:59 -0500 Cc: Niels Dossche , internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <6D9C1AC0-1AA5-409F-AC07-2327922E1EB9@pmjones.io> References: <39597a9c-6854-40c6-a529-32b2b178cb27@app.fastmail.com> <7bc87f46-7d5a-4848-b505-a77499281f45@gmail.com> <88839E7C-E41B-434F-B7D5-16240D64ABD3@pmjones.io> To: Levi Morrison X-Mailer: Apple Mail (2.3826.400.131.1.6) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - premium76.web-hosting.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - pmjones.io X-Get-Message-Sender-Via: premium76.web-hosting.com: authenticated_id: pmjones@pmjones.io X-Authenticated-Sender: premium76.web-hosting.com: pmjones@pmjones.io X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched From: pmjones@pmjones.io ("Paul M. Jones") Hi all, > On May 1, 2025, at 09:29, Levi Morrison = wrote: >=20 > On Tue, Apr 29, 2025 at 9:48=E2=80=AFAM Paul M. Jones = wrote: >>=20 >>=20 >>=20 >>> On Apr 27, 2025, at 07:26, Niels Dossche = wrote: >>>=20 >>> Regarding performance however, rather than introducing yet another = completely new concept to do almost the same thing, why not try to = improve exception performance instead? >>>=20 >>> I just opened a PR that makes instantiating exceptions much much = faster, and this is only after like 15 mins of work. I'm sure there's = even more to gain. >>=20 >> I mean, squeeze out gains where you can where the effort:reward ratio = is good, but the following is a naive but representative result on an = MacBook M3 Pro: >>=20 >> ``` >> return false 100000 times =3D 0.075289011001587 >> throw exception 100000 times =3D 0.11530804634094 >> ``` >>=20 >> Do we consider a difference of 0.075/100000s vs 0.115/100000s that = big a deal when compared to (e.g.) establishing a database connection? >=20 > The first part, the 0.075 vs 0.115... yeah, we care. That's 50% > slower.=20 (/me nods along) A 50% increase in execution time, but a 50% increase in = things that when all combined take up (e.g.) only 0.01% of the total = execution time -- is *that* something we care about? And "care about" relative to what else in comparison? Something like a = starting a database connection might incur a much greater penalty, = drowning out the exception penalty in total execution time. But then again ... > But the thing is, the math with exceptions is kind of [un]knowable > because one of the key aspects of its cost is walking the call stack. > How deep is the call stack going to be when a given library throws an > exception? You don't really know. [edited to include your note about the typo] ... yeah, that makes it tough to determine how much of a penalty there = might be. How can we quantify that, if at all? In any case, if there are performance gains to be squeezed out of the = existing exceptions model (especially at a good effort:reward ratio) = then of course that's something to pursue. -- pmj