Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129230 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 10F641A00BC for ; Sat, 15 Nov 2025 12:16:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1763208994; bh=GAVFKueE4EqkNy0PGC8HWcEhFqclda4kHW/Wsv9VFZ4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FwnRsIi+YV01eI/MaqraSSgiiBiza46ybn4DLMImKyC1/ISdTryRfZEy/9FfcI3+x a4KJOwu64LWx7GEWo+AvOHFq0/mmOXJRx7P01QoBdP4H/VqX9U4KYtiGhV+pN/3nC8 3kU+tE/A97U12UNrbOkg1wmwoEbVVkLHzzy4Z6tj5JnzhRl8MOsqm+vJNaUOF97G7c SyzjUYzSE3fkFctMqwYZ916bKSmwHesFImB2khHxFioadiTa2GJobSZy7UBLGfBVDj Dz6c6/2FYU2zlmLhr6tmnr90hRfvL2ndzuGdyV3+pquk6Irl51XO2ETMMnfRbWEvb/ qi5leOzMiKyfQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E7DC21801E3 for ; Sat, 15 Nov 2025 12:16:30 +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=1.0 required=5.0 tests=BAYES_50,DKIM_INVALID, DKIM_SIGNED,DMARC_PASS,FREEMAIL_FROM,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-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) (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 ; Sat, 15 Nov 2025 12:16:30 +0000 (UTC) Received: by mail-vs1-f47.google.com with SMTP id ada2fe7eead31-5dbdb139b5bso2449177137.2 for ; Sat, 15 Nov 2025 04:16:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763208985; x=1763813785; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=GAVFKueE4EqkNy0PGC8HWcEhFqclda4kHW/Wsv9VFZ4=; b=bwHXkNs6IShnVSYMDYAjZWHjIlxD5ot9Q7+L2Gf7de7JgI7wpMli2TbnLzwP0RkE6T jIjS655pf46DWGCTy7qBSzqRMNQww6LpDqhP1VGaTdlqdbCNNktxmwU55D2vwv/G7fAB Qo9DIgR8SmZZtZ0EHpd2eEaP1F72P/YcuX83FI2xmJwdl+FzQ915wwaJnQdXOZTqFKcJ ViDRbyI8gAGVRYRZhV5nHZAiM2THbGwoEA/QYcSHFb6IznNeSFRDkR4kP/x+AB4ZYzTW CphHNHWDYOZAa5YNYQQHTMatG7TbcCfHcjX9TgbqCHq2O8EbqYdUbiB0haOFfu3T/ayV raWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763208985; x=1763813785; h=content-transfer-encoding:cc: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=GAVFKueE4EqkNy0PGC8HWcEhFqclda4kHW/Wsv9VFZ4=; b=BN1Rja+BJ4J5B4yjPFgLAJF6bs4dOouFxUv5BUy/2EqtxsNMcUxuwGqGKZEWn0bRr4 PUSKy2aKn2eCauOvQ2PhaleEMimJyFkym0RSq3x5tU0ywZCuKsQdRhuUOTvE6sP5hPY3 cmrD1ZP40rZc43LGmNBDoR7Bz7DIl+9s3vOQBMvnwPtcwgxXXVLRNfHpj0NtVagSnTAQ L9teEjRlIoeD9QvvpQPd5AY+Pc+N6Ob3uh4OlomeI56zonNBHrnHHFjNd6XTi13V16p2 5Coa1qKmxKn3R8BUCcO9/l1ZbvSQcODH9mMCcj/FNyK6Yb8gTzuAAA1g42nvP97JLQ5t Nqdw== X-Gm-Message-State: AOJu0YwgX4yTahkXoD2l65dVDv5bWRMYRxBcUFF3PAVaTfxoSQ0NuniE d/oKpKBCOR+SIshdd+6YSqiUgpDAnaPihuwNihWBO6aMYA6OBxEXupZw8Sk9J/EXqVAJimgxlDJ UW3iQTZOfclaPgqNKQmik+4T5p/cjmZWbdELBk8Q= X-Gm-Gg: ASbGncvUFqEj+qHJRcUtJxCuZT4VxTXoxzPV7MduPnR903KLoHYG0XH0JrepfATNEzV 1rZ4LArc3wgNIGuvkDc32Kwy1Ujw9xkFTAdAsKsmFwLJ6if7FbatzkyFeyZk0GGuULIzNoH94qY Mk+6pSY6+kwvFlsMYNLvkF1nunV4O5Lj81YY6MIDdDeNWLlKZAY6Sm3IOxWBLrv1bGW0UhW3m1a yuhyK9PFmQv+XZb1AKEek+Wa91yyb7+tzcRDVb/gcfzSQyl+GEfUugcxvDDXTJmqODIhkwo3+wS 2LiT6MsgS/bFtyFC X-Google-Smtp-Source: AGHT+IFg0bFruceM5y3JdhT4awBAnFgt+ReNByqSuMHjvpKzgcF1lqQFjG0cxRyR6rNC2XSByW6plGK1IJvRsh1RdFU= X-Received: by 2002:a05:6102:5a96:b0:5db:eeb6:812e with SMTP id ada2fe7eead31-5dfc54feeb0mr2559399137.18.1763208984892; Sat, 15 Nov 2025 04:16:24 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <6618a91c-5393-4f40-88b5-b5041ee09deb@app.fastmail.com> In-Reply-To: <6618a91c-5393-4f40-88b5-b5041ee09deb@app.fastmail.com> Date: Sat, 15 Nov 2025 14:16:14 +0200 X-Gm-Features: AWmQ_bm8-e91yc5fE47AR-YXWTCtdx1BIrJqrPM2RSGhWLYli_oTw6wplK6KWCw Message-ID: Subject: Re: [PHP-DEV] Re: PHP True Async RFC Stage 5 To: Rob Landers Cc: php internals , Jakub Zelenka , Larry Garfield Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: edmond.ht@gmail.com (Edmond Dantes) Hello all. Some of these questions sound familiar. Let=E2=80=99s try to sort them out. > If I have a tight loop processing data in memory (no I/O), will it monopo= lise the coroutine scheduler? Do I need to manually insert suspend() calls?= How do I know when and where? A coroutine must yield control on its own. If it keeps it through an endless loop, then it will be the only one running. > The RFC suggests that existing PHP functions won=E2=80=99t automatically = be non-blocking. So which will? Is there a way to identify suspension point= s at the language/API level? The RFC does not say that. PHP I/O functions automatically become non-blocking relative to the whole process. In other words, an I/O function calls suspend() on its own when needed. The programmer writes code exactly as before, under the illusion that operations are executed one after another. > Performance implications: Without knowing where suspensions occur, how do= developers avoid either: In most cases, this is not the developer=E2=80=99s concern. Situations wher= e performance is critical should be handled with dedicated tools. A PHP developer should not have to drop down to the C level. Properly designed abstractions must provide the required performance. I can already anticipate the question: but a developer could write something like =E2=80=9Cfor i < 10000 suspend=E2=80=9D or something similar= . The answer is this: a developer must know how to use abstractions. As always. Everywhere. In any area of programming. It=E2=80=99s just as important as respecting proper layering in code. Provided that PHP does not try to play the role of a C-level language (there have already been such attempts, and they keep resurfacing), and does not try to play a web server or a database system. For most web scenarios, the current approach is more than sufficient. This has been proven by Swoole, which has been on the market for many years. Therefore, performance questions are outside the scope of this RFC. As for the concurrency model, let me remind you that Go has true multitasking. Goroutines in Go, although they have a =E2=80=9Csynthetic=E2= =80=9D stack. But you already know all this well. This RFC and its implementation describe coroutines in a single thread. That is very far from what Go provides. There is no preemptive multitasking in this RFC because it is completely unrelated. This RFC and its implementation provide cooperative concurrency in a single thread, where coroutine code yields control on its own. Why was this model chosen? The simple answer is: because it is the only one that can realistically be implemented within a finite timeframe. Any more questions? -- Ed