Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107740 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 71965 invoked from network); 30 Oct 2019 23:59:30 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 30 Oct 2019 23:59:30 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id C2B952D1FA7 for ; Wed, 30 Oct 2019 14:47:04 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Virus: No Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Wed, 30 Oct 2019 14:47:04 -0700 (PDT) Received: by mail-qk1-x733.google.com with SMTP id y81so4510483qkb.7 for ; Wed, 30 Oct 2019 14:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=k9ha1gTMBq6imHCCnGS44K/c37poG6VhJTKZ1+q9IZs=; b=iWBwpfQSgrewS9VCte3H9Uxcw0mlTLqbsX+QKQA9a6TE1LLetCaOzTmvrYv/z/5EVl ZlbUm/QPr6SxJ/QXWgO353YY3dCvCzCghPI7PvyDT3jo+RS/siGUqKmFmjzJwCPxlOgY uyk4Lh09QXcWs3uyK0rqrBl17cGYzpQPiK4EJPloJnToc96sbzk4YHWy5JVAULYlIgbw uwUoq3aUGK1vCglbRR+fwnDKHT9UMTmFqXK5Tq39PwHw9XY3Zzr7tzapM/Tg7GocO7W+ Ko94bR3/QNROnE4A7DqjtX/iB6bwVUnOCM/XsFcjKXKsbTIsnBxpMVFXs61i4LpDxW5F JLMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=k9ha1gTMBq6imHCCnGS44K/c37poG6VhJTKZ1+q9IZs=; b=jRAs+gQ8dGdF9u9qB9A6c8po2TlKyB5YbABzNDJEqBWhmidKjCqPrg1b6TSn0au3Os u8qES5NP3HIo9lvtzINc8TUW+uzhRz/q8+8WFCqmVmSLm2SPlHa8nDgTGNrAvjVO83Qy u0eWwV36rCl2zfdXdZzARxZCN4ZsDOXoZJT51Mj3TlWpnG5NvByqUvJ7DvpWrsTqwVL4 uKvwPeeX+V7AWMCEJ2IYspLInbnDXsGP8o61n83GieI63JoNvcsvNdZXSLiYVuK6aaNA WABPioinSYu5FBx6BfL9BYtNWgOxUaRnuzYhPT24mDOFRcxY7IBQre6K740z1tJ0RG1o i2dw== X-Gm-Message-State: APjAAAVGxlblze6Tw9BdGF9IRIRdhwZezQbiARbTxd0Y99pfc9MfbOgB hrVV/zQA72ls5GJYSiNqWlYxUYaVjkg= X-Google-Smtp-Source: APXvYqzH+PFirKlmsUMNPFwyOxOTE9jYI7atjz8WDrBugt9sCApf6R3V9LmeeHu/IjjHFzKE/NKxvw== X-Received: by 2002:a37:ad8:: with SMTP id 207mr2104741qkk.492.1572472022704; Wed, 30 Oct 2019 14:47:02 -0700 (PDT) Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com. [209.85.160.172]) by smtp.googlemail.com with ESMTPSA id o53sm777676qtj.91.2019.10.30.14.47.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 30 Oct 2019 14:47:01 -0700 (PDT) Received: by mail-qt1-f172.google.com with SMTP id c26so5458114qtj.10 for ; Wed, 30 Oct 2019 14:47:01 -0700 (PDT) X-Received: by 2002:ac8:67ca:: with SMTP id r10mr2412457qtp.124.1572472021187; Wed, 30 Oct 2019 14:47:01 -0700 (PDT) MIME-Version: 1.0 References: <9d3f9895-5ab6-1d75-4eb2-0ba93f13a8fe@gmail.com> <393e5c3c-9902-f6ed-bbb1-5ba48294168c@xs4all.nl> <73f639fa-0161-3ac2-ff7a-c249c83a2596@gmail.com> In-Reply-To: <73f639fa-0161-3ac2-ff7a-c249c83a2596@gmail.com> Date: Wed, 30 Oct 2019 22:46:49 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Rowan Tommins Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Envelope-From: Subject: Re: [PHP-DEV] Optional pre-compiler for PHP8? From: andreas@dqxtech.net (Andreas Hennings) On Wed, 30 Oct 2019 at 22:06, Rowan Tommins wrote= : > > Hi Dik, > > On 29/10/2019 21:44, Dik Takken wrote: > > Opcache already performs type inference. [...] > > Here is an interesting read on the subject: > > > > https://depositonce.tu-berlin.de/bitstream/11303/7919/3/popov_etal_2017= .pdf > > > Thanks for the link, and the insight into how much OpCache can already do= . > > I guess preloading gets us pretty close to the tool I was imagining - > OpCache could make assumptions that cross file boundaries, within the > preloaded set, and could spend longer optimizing during the preloading > phase than might be expected on a simple cache miss. > > I think it will be interesting to see how tools adopt that feature, and > whether eventually we'll see autoloader functions as just a fallback > mechanism, with most packages being enumerated in advance as large > preloaded blocks. What if we had a "native" autoload layer? The native autoloader could be made to fire before userland autoloaders. It could be based on a mapping like PSR-4, or simply a classmap. The mappings could be defined at "compile time", or frozen early in a reque= st. This would allow to predict where each class is located at "compile time" or at opcache time, allowing to do all the type checks. An alternative would be to allow userland autoloaders to be registered with a hash, with the promise that as long as the hash is the same, classes remain where they are. Or allow userland to specify "class locators" instead of autoloaders, which could also be registered with a prediction hash. So, the overarching idea here is to make autoloading predictable at compile time or opcache time, and would not require an artificial "package" concept. As in my previous proposal, the opcache would have to store different versions of each file, for different combinations of autoload prediction hashes. This would allow e.g. different applications to share some of their PHP files without spoiling the opcache. -- Andreas > > Regards, > > -- > Rowan Tommins (n=C3=A9 Collins) > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >