Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113124 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 55019 invoked from network); 9 Feb 2021 07:36:57 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Feb 2021 07:36:57 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0D7061804D1 for ; Mon, 8 Feb 2021 23:21:52 -0800 (PST) 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.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ua1-f43.google.com (mail-ua1-f43.google.com [209.85.222.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 8 Feb 2021 23:21:51 -0800 (PST) Received: by mail-ua1-f43.google.com with SMTP id v17so2453924uat.0 for ; Mon, 08 Feb 2021 23:21:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mjknUNHLPIdJ2tSt8IKeF9Jk+pmmdoXazWcitfE5nC0=; b=JPGIAtk+J+tTrb2r3uhXphSleAemZXkbgBonCRXxl8GxBnrBzvnZkXVkk1aspqnQel xtFybJOXwEHJWU1uz0wpk4mKCYo7RL4hlFHP3TSpHEX8rwzEqheRgvMkU199s2BNL5PL 4BaEbMI1AVbABcpZSUgsW7dbb8ozdcatGx/Jwr0sGwKUd+vDkLGkHyFdX3kEQlg6mGo4 X/wWp3Mi5LJ4mYRs6M5Vc1X44cne1Ff18Sw3UJgAGYkbQsmdsOodfRGqX2QOsSqU89mi mJjpMVP8eT51YvyJukcnPpn5XbI6mdxyE3wNG1shldYoAgrcpRCu8C0Unm7NUlF4qP6Y YikA== 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; bh=mjknUNHLPIdJ2tSt8IKeF9Jk+pmmdoXazWcitfE5nC0=; b=D8b4XwgliAvVNwtS+MrSOnJX1JLCnnmvaxyEAjhQSRcFVgabnlBOR/CVk9fyrBlF4J AWYEqQGod+iWnKfiyS97EEtQ1pAbpdWZMyE2gtQfpaioP7A9WZDdTO7xTQu/WCmkYHui rgw+qnnBnlpd7/kCh0YYGtvj6gSIKiMJv5VX5RhYYJEQpDYTURBhhMwvpexfoG5pRwO/ WJFH4ORS+9NWg1GAOY97BkYdomkZzbz8+UQ+UpeGE/0cKx0+r44bhkXS/btDSDOJIxbg 6kZOxsYQuqjLwXI322DmgsDBBdz1HFtm4zBjxLuEYm930ghHPFUmP8Oh9/4mDxRbpxj2 2Hpg== X-Gm-Message-State: AOAM531fFgerTxnS93kbDBKLfmxn5JmO6XtIDaY+wvbczW5LZqTv8npv UAmdgLI1HOrHGFUOol8w74MYL9FeS85qJt8qZoF2pnvjtc8= X-Google-Smtp-Source: ABdhPJxzWugeNbvXjoyjSwn0Hbpl9XgfiRkfJeBbkk5Xr1uuDEN+wOA1wq66L4gNijtXY5c/aF3P5/WKSu2WrUfgK5E= X-Received: by 2002:ab0:24d5:: with SMTP id k21mr397538uan.30.1612855310849; Mon, 08 Feb 2021 23:21:50 -0800 (PST) MIME-Version: 1.0 References: <3A0832D2-F886-4F21-B16B-1B660BC0FB91@stitcher.io> In-Reply-To: <3A0832D2-F886-4F21-B16B-1B660BC0FB91@stitcher.io> Date: Tue, 9 Feb 2021 10:21:39 +0300 Message-ID: To: Brent Roose Cc: PHP Internals Content-Type: multipart/alternative; boundary="000000000000e0978305bae223c7" Subject: Re: [PHP-DEV] Inheritance Cache From: dmitrystogov@gmail.com (Dmitry Stogov) --000000000000e0978305bae223c7 Content-Type: text/plain; charset="UTF-8" Hi Brent, Preloading had intention to completely eliminate opcache overhead, but because of limitations it wasn't able to preload classes with unresolved constants, typed properties and covariant checks. This PR makes these preloading limitations less strict and adds transparent inheritance cache. Inheritance cache eliminates only part of redundancy, in comparison to preloading. It should be a bit slower, but it will work out of the box. Thanks. Dmitry. On Tue, Feb 9, 2021 at 8:40 AM Brent Roose wrote: > Hey Dmitry > > Out of curiousity: how does this compare to preloading? From what I > understand preloading also links classes, which was one of the most > important differences between preloading files and simply storing them in > opcache. Does this change mean that preloading becomes much less relevant > since class linking can now also happen at runtime? > > Kind regards > Brent > > > On 5 Feb 2021, at 15:03, Dmitry Stogov wrote: > > > > Hi, > > > > I'm glad to present the result of my recent work - Inheritance Cache. > > > > https://github.com/php/php-src/pull/6627 > > > > This is a new transparent technology that eliminates overhead of PHP > class > > inheritance. > > > > PHP classes are compiled and cached (by opcahce) separately, however > their > > "linking" was done at run-time - on each request. The process of > "linking" > > may involve a number of compatibility checks and borrowing > > methods/properties/constants form parent and traits. This takes > significant > > time, but the result is the same on each request. > > > > Inheritance Cache performs "linking" for unique set of all the depending > > classes (parent, interfaces, traits, property types, method types > involved > > into compatibility checks) once and stores result in opcache shared > memory. > > As a part of the this patch, I removed limitations for immutable classes > > (unresolved constants, typed properties and covariant type checks). So > now > > all classes stored in opcache are "immutable". They may be lazily loaded > > into process memory, if necessary, but this usually occurs just once (on > > first linking). > > > > The patch shows 8% improvement on Symphony "Hello World" app. > > > > I'm going to merge this patch into master on next week. > > Please review and give your comments. > > > > Thanks. Dmitry. > > --000000000000e0978305bae223c7--