Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92472 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90502 invoked from network); 19 Apr 2016 15:59:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Apr 2016 15:59:23 -0000 Authentication-Results: pb1.pair.com header.from=cornelius.howl@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cornelius.howl@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.194 as permitted sender) X-PHP-List-Original-Sender: cornelius.howl@gmail.com X-Host-Fingerprint: 209.85.214.194 mail-ob0-f194.google.com Received: from [209.85.214.194] ([209.85.214.194:35940] helo=mail-ob0-f194.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 15/30-22821-AD556175 for ; Tue, 19 Apr 2016 11:59:23 -0400 Received: by mail-ob0-f194.google.com with SMTP id ds1so2229621obc.3 for ; Tue, 19 Apr 2016 08:59:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc; bh=WCSGzGlrMn2DFKl6ocFzWzubggX1sM80uVbuINu1uYM=; b=JTbgugg91C+vodgJv+rMXaVdjLq1E7JqePdbI7lwrYbT4GwMGxIxfQuQmfm28NQ4LG jfxe582hSFuvcVP4FbmFpA+761yjEpK4n+DqVLEI2JbfzfeFHOHgRyluhqpx9E/EQuEN HHR+hMKIvdZAgqM7nd3A1pOiIIBL8RtvzKG59XouKfZkPG6BEO+436saQGS22CyRWa/j AN4Ih+VU2oQ79rOCNrqpWKq8Qgdear1aoZ07YlUzydm8TcwL6yV+iipg80pUnPAHlqgg wnmYV9ctiRfYCbPStn4+v+iWL+p4hlsieb+o3OVySdngj3dFMb8QN++ai5uOsGC/TgLH MBAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc; bh=WCSGzGlrMn2DFKl6ocFzWzubggX1sM80uVbuINu1uYM=; b=bnpP6xKtNIt4jIn+7bGiZpj8DJ7MFd7yRmydA4n0yacxf1I1LiiLwFLnGyAUZLk+ak opZRzU1c940xgEYE2oUCH7IPUpr1DeDNT8q3BbJC2LH2o6lcAYm14oUyfYzJyiecfBol V77lYfcKaZIU6873IB91MY3S4BGIM6NuEHgzxdpswf/lCrUEIl8mVYWqGNnYJMH5IBR9 C3cZlFwazgbQeHaFuZ7W1nI6a3/+R9BOKnwYvKUYarYwVmSuaPACu8gn2XkJskaPZv02 2JaftpS69Uqgad2ykGcWc1vSuD6cw0B0tFwpF0kTl9md2LQcsmr/GYsYoGaEXLypR8Tt tmwg== X-Gm-Message-State: AOPr4FWeDLuSwCXmZSS0n2kAvSrbo8C75I6lKrLG6Xh69DMeJU6ikmEGPvwurLCgXEDJ2yiLwmcSHQ0AV/BQqw== MIME-Version: 1.0 X-Received: by 10.182.105.65 with SMTP id gk1mr1544385obb.37.1461081559964; Tue, 19 Apr 2016 08:59:19 -0700 (PDT) Received: by 10.157.7.194 with HTTP; Tue, 19 Apr 2016 08:59:19 -0700 (PDT) Date: Tue, 19 Apr 2016 23:59:19 +0800 Message-ID: To: =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=e89a8ff1cf9c5ea9420530d88fe4 Subject: Re: [PHP-DEV] Proposal: Startup snapshot for optimizing app load time From: cornelius.howl@gmail.com (Lin Yo-An) --e89a8ff1cf9c5ea9420530d88fe4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Apr 19, 2016 at 3:10 AM, Fran=C3=A7ois Laupretre wrote: > > Le 13/04/2016 17:55, Lin Yo-An a =C3=A9crit : > You are mixing 2 related mechanisms here : code persistence and data > persistence. > > Code persistence (reloading the same code again and again in each request= ) > is achieved through the autoloader. Autoloading, compbined with opcache > provides a very fast mechanism to retrieve class definitions. If you > measure the time taken by your 'require "vendor/autoload.php"' stance, yo= u > should find it to be extremely fast (with opcache on, of course). > "vendor/autoload.php", in this example, is pretty simple, however in most applications, there are bootstrap script for bootstrapping services (mongo service, mysql service, sms service ... etc) and setting up some configurations. Data persistence is another question: the need here is to save and restore > object instances. Several cache mechanisms exist for this, saving and > restoring via serialize/unserialize. The problem with your 'bootstrap' > approach (apart from the fact that it is not physically possible in PHP) = is > that you won't want to snapshot the *whole* environment, because you alwa= ys > want to keep at least some dynamic context. What you actually want to > 'snapshot' is a set of well-defined object instances. So, the question, > IMO, is to develop a mechanism faster than the current ones to store and > retrieve object instances from memory Yes! not all global variables will be snapshotted, for now I think EG, SPL_G (which saves the autoloader instances), and some object instances and zval. Then these opcode could be skipped a lot. So this looks like something on top of opcache. --=20 Best Regards, Yo-An Lin --e89a8ff1cf9c5ea9420530d88fe4--