Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129797 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 3E65D1A00BC for ; Tue, 20 Jan 2026 17:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1768930038; bh=mA+zIOBlNZnIJMW0Nvs57tvHVbYTLsH2hnUaB/S1QN0=; h=References:In-Reply-To:From:Date:Subject:To:From; b=SEikNk8cG65Bo7PwmJMyi+iuxW+XR/gN8pXSuFqu1aRQJ5Ho4w2UH+HvNSODKBRar szxSoCLN8oq7xdKYGYqzTXX1bV3u9HhHanX/3u/S9xNBvj/AVsWMwMaY0xrd8bd04y INp8e/f93H1UKg0k0MlhmGNID7wuIgpAiIzLTobAFh25MzJMtbDZzxC5b12ILYqYdJ vdqfwtuccnJM3/KbN7z/ZCPQXBboUTsz3UTjGfdhvFIl0121i5DgPLS2wpgs8t9Sgq F+sVIIxv2g3bCnfjLnLofsbI3s0g1R7V++4F01I+1U9YQiWD1hUcyUnbRnaSBbmrLo OPCez6xt/GNtA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2FFE81801E8 for ; Tue, 20 Jan 2026 17:27:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 ; Tue, 20 Jan 2026 17:27:18 +0000 (UTC) Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-47d63594f7eso40488345e9.0 for ; Tue, 20 Jan 2026 09:27:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1768930031; cv=none; d=google.com; s=arc-20240605; b=dX6Lkm/EPmNC9pw+xliGBg6sKg1CTmdPlSeWwB6W986y3puMdvyeI6eLCqDh5bVyLY xjI0hlU+QZtW1kh04egNFnteCeGZBK0PyuojyjoCUxA4+19ShilT7HHm8RWkpLbD6Xe3 XKxV/xadiS+6ieCzwm9c/KgDdws6rgD2jUhu0JzVuctggkCUAoTyfWx0B2emvvSH9as7 cm5VPeLOVV5fhDcA0kWllDD+ZNOZtsw879/l1ZF2ZsGZnR+Wh3tKfMU5kCT0dLKdsKbR B47R/nW4vf3UqBWdDNxRnIDxrYMa7mv6U0AHJwVOMOC/Icd3xG6/7vo4WoxlXLH+UJF3 Q4RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=0Eap09/3ZifJYBo8w+KJIL66TGbwmKQmKbJ9TM2pgVg=; fh=PwvV1jWZOR90rDIG/6XexqaHJyAFBTdnFVhsS64qdEQ=; b=dvVF/XpLl4me0PuIPZX04mL2EIVmpjhyQ2u6mrWhyuFB3cJ2sXtJlr4qgdfBb9qLka uK5KQWEMxku/zy0dWzEYawdJZdV9bmAYKUdWXix9+qOooZetaszXXMFQTyNPQ33ZVO9N 8NnautzgoOeAF9+Ksshls7WXqsJzV6n8WhadyFZ/aKUXXrbQv5Zh1pvSlKfqV7ebXc8M Ijpe3NxGHN98JHQTXj0kcDYaULfeJEI6MUZAeo/cjnLRxu8CPJEEo+mP1bbJYwqXL5ve Qzs6DlaARv8vDneh8+UI9UO3OmYVLQMftIbnPbvFMFdfaIiPi8h466YBcT1Wp7F/fCH2 cGTQ==; darn=lists.php.net ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768930031; x=1769534831; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=0Eap09/3ZifJYBo8w+KJIL66TGbwmKQmKbJ9TM2pgVg=; b=IqfKQ9yZFdsOhKb+TeZdfEGvd0S31dLC99dpN+tHUvjmtIVW5DuNKl25g/XOvGU11j zSn9lkDodMewUsdhAKSeRwniOluaQBfJciuM4qCGPnnFy5l22TwZK9kdRZkhN2fPuUD5 LExcqnI27KLjlo1mJTxoGOxvsaMWZnWgf7ShoCan+wSuSZn58VCZWvzvP9uuPwmLgqQb Y4/s9U6iwwZd6cuwefg6O/bUuZ2KnPKAfrtaap19DfiIUZ/kA/5YV8M5LZX9Udgp1kFj AaV4dsG0fMLamD1Xa0oyGHD++m8nf08dsrF+Mswq2YVelqIvUe9dLnZlEr/SXhbDYE/f rbtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768930031; x=1769534831; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0Eap09/3ZifJYBo8w+KJIL66TGbwmKQmKbJ9TM2pgVg=; b=JSAsQoOFJvxx7mGdjGEhQjllqWZariRulfWWRLR5Wm6nyrDoPKJYJKSxq2vxSlVhgw ZV8yR7+R7i7B0pztz+ckkXyX/QuKhe1dtevjJkjZUqcpwf1vnYtCHd6QOYKghkx85Tmh 59e7Rl76eC8Y9SHUgW9p+lJNxXxYY9vZjxw0k1LS6gOT7e8e+DuqGaiTmCphQNlfoRc9 vZeRGpzAnMi/IuFRVBnQnADWwiG4WhHfkX07qFS8fLiMtkGTrk8Q+yLy4MlFtup1W0zy PVjpLtssFCtOIr6El6nhWdFUoealhlB5o7iO8WEXfNZ7FfwCwo2b2fk6EGyaQcO3dXw2 UDcw== X-Gm-Message-State: AOJu0Yw2Ou1qtQq2dxMFsDzXQadDivjNr90wJJiXftUPwy+mSnnXMhpf F6qufdtMDGDC7/zLa0PQXXATm9NuIMoUUFXSFfPhBl1PtqdswMmmY4p9+kEaSt4QmTH1kB8eu3X Be9D3nH4u0ZIOuSpCoBS4nhZxZZZJtXNgno3v X-Gm-Gg: AY/fxX6gzacu9n665+mSHnxkX8PswsHYjFwRdVeRhIXfIdYT9y0RMzejR9fNTG5/inv wQd53LwKJlLmj77iibn/BzFlZrtKUa+wWN4JYAafW4ztnf/mENhkKe/XVDAdAnpjYVt2cGNsVqT 1mAbpdxyUNGNZ0Sq+CnbR6bSx0m4I/kuEMyNE7OxA+TjDZnay2LWHe9X7yrhB0rWvTAMbYde0R/ 658v98efEXAkUkWabdhQKCQ6PeRNJL2CdubPxVKfmk2tUnweJe0MiJGLn7GUay+Q7Sx X-Received: by 2002:a05:600c:4ec7:b0:477:7af8:c88b with SMTP id 5b1f17b1804b1-4801e30b6f4mr167217865e9.11.1768930031213; Tue, 20 Jan 2026 09:27:11 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 20 Jan 2026 18:27:00 +0100 X-Gm-Features: AZwV_QguXxWOOZr7lp3_cMG36vtxduL7j81p2GJE7e166J4vWhugu_V2SPimHsY Message-ID: Subject: [PHP-DEV] Re: Optimization when extensions don't provide handlers To: PHP internals Content-Type: multipart/alternative; boundary="00000000000024aa220648d51e0d" From: barel.barelon@gmail.com (Barel) --00000000000024aa220648d51e0d Content-Type: text/plain; charset="UTF-8" On Tue, 20 Jan 2026 at 15:28, Barel wrote: > Hi > > I have seen that the php-src uses some flags > like ZEND_EXTENSIONS_HAVE_OP_ARRAY_HANDLER to optimise the code so that the > loop that calls the op array handler is not called if no extension has set > up an op array handler > > I wonder why this has not been done for > the statement_handler, fcall_begin_handler and fcall_end_handler. This > could be used to provide an optimised execution when no extension sets up a > handler for these extension points > > Interested to know if there is a technical reason for this > > Cheers > > Carlos > OK, I reply to myself. I can see that these handlers are only called if the corresponding opcodes are compiled and these are only compiled if ZEND_COMPILE_EXTENDED_STMT or ZEND_COMPILE_EXTENDED_FCALL are set. So an extension that does not set these handlers would not set these compiler flags, then there is no need to do any more optimization :-) --00000000000024aa220648d51e0d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, 20 Jan 2026 at 15:28, Barel <<= a href=3D"mailto:barel.barelon@gmail.com">barel.barelon@gmail.com> w= rote:
Hi

I= have seen that the php-src uses some flags like=C2=A0ZEND_EXTENSIONS_HAVE_= OP_ARRAY_HANDLER to optimise the code so that the loop that calls the op ar= ray handler is not called if no extension has set up an op array handler

I wonder why this has not been done for the=C2=A0sta= tement_handler,=C2=A0fcall_begin_handler and=C2=A0fcall_end_handler. This c= ould be used to provide an optimised execution when no extension sets up a = handler for these extension points

Interested to k= now if there is a technical reason for this

Cheers

Carlos

OK, I reply to myself. I can see that these h= andlers are only called if the corresponding opcodes are compiled and these= are only compiled if=C2=A0=C2=A0ZEND_COMPILE_EXTENDED_STMT or=C2=A0ZEND_CO= MPILE_EXTENDED_FCALL are set. So an extension that does not set these handl= ers would not set these compiler flags, then there is no need to do any mor= e optimization :-)
--00000000000024aa220648d51e0d--