Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103935 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 45034 invoked from network); 31 Jan 2019 20:08:01 -0000 Received: from unknown (HELO mail-oi1-f195.google.com) (209.85.167.195) by pb1.pair.com with SMTP; 31 Jan 2019 20:08:01 -0000 Received: by mail-oi1-f195.google.com with SMTP id y1so3241844oie.12 for ; Thu, 31 Jan 2019 08:47:56 -0800 (PST) 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=/ITxTbgIRMwdgM0FKCTIig4qy3VfcwdiQEbg3751NAU=; b=ZT6S6vmf2kzlW04tVoHTHFEfG4KTuqccugM2Aff7z+JClaJjCGXQfBRoHI8WjTCPnr 5Fn6mq32/IK17hNuPnPZYsTiTcAvFXnyjfucULxSExNt1Zjnj7i5HlHJe9Kw8TjdL21c S706n7hiGpud4+Zy2fmiHhDew63IyuQfbAPEr4nPctHDgLhctD2ver475H5B2CpkhJJ1 Y4VXs/+fYJNnhtTX2rPzKSBzxaDwWPxxaYgsgOaqG4cXTm3YuIHzqKcD7Q7w87AyfAdY rnW4x4m7J/YJhhDSi2NOGkolHJ3X7x8cKkloiEqcBgH2ENB2RUOfRCMUCeFML8IMlF9O b+Qw== X-Gm-Message-State: AHQUAuZ5Tnw83M1LsRcsYXNv39CKoZowCjzNy83Ib0dM/E9Y/Uq05KsH 6Jx8iRqLmkd7S1EJbSlTP0qfGa6Pk/A0tebvJ5I= X-Google-Smtp-Source: ALg8bN4c0WPYkLY1bJWvMmKxDfJvZa3/Q5OqJbBaGEVQCgOzJ+t6IWUmXw9L/91HNPSMvehu0SqUTmeekvRpw+j8XSA= X-Received: by 2002:aca:f044:: with SMTP id o65mr14772454oih.145.1548953275980; Thu, 31 Jan 2019 08:47:55 -0800 (PST) MIME-Version: 1.0 References: <8d9dffd5-ea2c-e642-b777-4a4fd76b261a@zend.com> In-Reply-To: <8d9dffd5-ea2c-e642-b777-4a4fd76b261a@zend.com> Date: Thu, 31 Jan 2019 18:47:44 +0200 Message-ID: To: Dmitry Stogov Cc: Nikita Popov , PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] JIT From: kalle@php.net (Kalle Sommer Nielsen) Den tor. 31. jan. 2019 kl. 18.39 skrev Dmitry Stogov : > > > > On 1/31/19 7:01 PM, Nikita Popov wrote: > > On Thu, Jan 31, 2019 at 10:44 AM Dmitry Stogov > > wrote: > > > > Hi Internals, > > > > > > I'm glad to finally propose including JIT into PHP. > > > > > > https://wiki.php.net/rfc/jit > > > > > > In the current state it may be included both into PHP-8, where we > > are going to continue active improvement, and into PHP-7.4, as an > > experimental feature. > > > > > > Thanks. Dmitry. > > > > > > This has been a long time on the horizon, nice to see this finally > > moving forward :) > > > > Here are some initial thoughts: I think that it's best to approach this > > issue from a cost/benefit angle. The benefits of the JIT compiler are > > roughly (and as already outlined in the RFC): > > > > * Significantly better performance for numerical code. > > * Slightly better performance for "typical" PHP web application code. > > * The potential to move more code from C to PHP, because PHP will now > > be sufficiently fast. > > > > However, there are also a number of costs, on which I'll expand in more > > detail: > > > > a) Maintenance: This is really my main concern. Right now there are > > about 3-4 people who I would trust to carry out a non-trivial language > > change, which will require touching the compiler, the virtual machine, > > the optimizer and the persistence layer. Each of those components is > > quite complex, in different ways. Some people who are comfortable with > > doing VM changes will struggle with implementing optimizer changes. > > > > Adding a JIT compiler exacerbates this issue further. Because this JIT > > is dynasm based, the core JIT code is essentially written in raw x86 > > assembly. This will further limit the pool of people who will be able to > > make non-trivial engine changes. Personally, I don't have any particular > > familiarity with writing x86 assembly, so it will likely take a while to > > get up to speed with this code. > > > > b) Bugs and stability: I think that everyone is aware that the initial > > PHP 7.3 release suffered from substantial stability issues, more than > > new minor version releases tend to do. I think there are multiple > > reasons for that (and we might want to start a conversation about our QA > > processes in a separate thread), but one main contributing factor were > > opcache optimizer bugs. Compiler optimizations are tricky and hard to > > verify, and we often only learn about issues once the optimizer makes > > contact with production codebases, which feature a much richer > > collection of code patterns than our test suite. One can wonder whether > > the relatively minor speedups we get from our optimization framework are > > really worth having these stability issues... > > > > Adding a JIT compiler adds a new dimension of stability issues. Next to > > "simple" executor bugs, and optimizer bugs, we now get additional bugs > > in the JIT. These are probably going to be hard to debug, as we'll have > > to drop down from our usual C-level tooling, down to inspecting assembly. > > > > c) Platform support: Having a JIT segregates platforms into two tiers: > > Those that have JIT support and those that don't. While that is not a > > problem per se, it does introduce some dangers. For example, if we > > decide to more parts of our C code into PHP because PHP is fast enough > > with a JIT, that will of course only be true for platforms that actually > > have JIT support. I'm not terribly concerned about loosing out some > > performance on MIPS, but we do need to make sure that all our main > > platforms are supported (Windows is a must there, imho). > > I don't see any problems with including JIT without Windows support. > Windows runs PHP much slower any way. Without my usual Windows bias, I do believe it is a considerable fact like Nikita pointed out as Windows is a first class citizen in terms of operating systems we support. While PHP on Windows may not have the speed that the Unix counterpart have, it is still a very important development platform. Many developers develop on Windows and deploy on a Unix based system, being unable to test such an important feature in a development environment is also a large question mark. I'm personally interested in taking a look at it (and I'm certain Anatol does too), but simply dismissing is a no-go for me. -- regards, Kalle Sommer Nielsen kalle@php.net