Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89213 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21103 invoked from network); 14 Nov 2015 04:44:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Nov 2015 04:44:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.217.174 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.217.174 mail-lb0-f174.google.com Received: from [209.85.217.174] ([209.85.217.174:35130] helo=mail-lb0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E4/F3-62946-21CB6465 for ; Fri, 13 Nov 2015 23:44:03 -0500 Received: by lbbsy6 with SMTP id sy6so35650661lbb.2 for ; Fri, 13 Nov 2015 20:44:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon_com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=pf0+jUoGB96OHWtTZjUjlLTNUwR8xjMqK7K8jtRySsg=; b=zcDGm3tADJ0L62buRFTa8vKtNvG3lLD73BO8tOcG4GbSbxaFRQLunrtHlY5hwHy/WE laSG3YmnbAxZFRruaSgXTdbiN6kLwfVcd9jjciwWd4XjJ0wlB0xXIWO0D1vWgZn7Xjb+ bCesDkRlSJRLp0m/yBbVyV/PARqVubszciwbb4hPXqbS05My+nZQT6PcosE0Ok1Ljztl w3UG6e4wunBC0vgsiTqYJjw4Pr3lOY/l+RhaS9qVadY5we3vIn6r86RjJujzPRrMXxU+ 67O1Lq59Py9jjcwSF9hh5fUtud/+B/pwxmrRAfvwf0KcvhsZc/qYZs+sGUoul8Mp1lzY 4E2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=pf0+jUoGB96OHWtTZjUjlLTNUwR8xjMqK7K8jtRySsg=; b=TY7SVQ2VRl1LZ9PDqn1s/3I6toB8FVQBg+MRCsr3f6P0AsbW8b060mFHF5bgHSkNA7 stYwKldlOkBuHZuPnF5CsAFN2xVdej7EHDQgO892e8xVONWRJB1PMG3Q1OunVgnBhbHs Vpdtmnyj9wqcKZAZmxGitRPsbKNkUGOf67GrzAWDHQ5A6WTZ0Cc92fruWQtNkKxhFi7q WK61gP+V3FZ3EBTBpxsex11kd4sgonz+M6rx20LPmMpfznzgLzPpv6BPRAkIHsFa7W6E 8T09sdBaV6KUjMyoSahYyXIZS7jEWQTla2Qocq6lDkY2lvAUn+aArE38t/SpqT76ULFW K1kA== X-Gm-Message-State: ALoCoQkKrVs9V3yTory354liwVd07Z20xYQXLnIn8cDheW3A0hBVHDn3F79nX2kCkpn1+lUVhTNn MIME-Version: 1.0 X-Received: by 10.112.168.194 with SMTP id zy2mr12183139lbb.79.1447476239929; Fri, 13 Nov 2015 20:43:59 -0800 (PST) Sender: php@golemon.com Received: by 10.112.184.74 with HTTP; Fri, 13 Nov 2015 20:43:59 -0800 (PST) X-Originating-IP: [199.201.64.3] In-Reply-To: <12.A1.62946.CB756465@pb1.pair.com> References: <12.A1.62946.CB756465@pb1.pair.com> Date: Fri, 13 Nov 2015 20:43:59 -0800 X-Google-Sender-Auth: NUg_xgIe_4Hdci1dkAVD8TRF4dk Message-ID: To: Stephen Coakley Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Support for writing and executing compiled opcode From: pollita@php.net (Sara Golemon) On Fri, Nov 13, 2015 at 1:35 PM, Stephen Coakley wrote: > I've been thinking about PHP optimization and distribution, and I would like > to hear some opinions on introducing a new feature for a future PHP 7 > version. Here's the concept: allow PHP opcode to be both saved after parsing > a file, and to be loaded and executed, similar to the bcompiler extension > and the APC bin functions back in the day. > Back up. What problem are you /actually/ trying to solve? OPCache does a very good job of caching the result of compilations, and it's a standard, bundled extension in common use. Is there a hit for that first load? Yes, but webservers run a very long time, and a priming step during deployment is more robust that pushing pre-compiled script databases. > The advantages are clear: libraries and applications could be compiled to > opcode ahead of time so PHP wouldn't have to compile it again and again > (assuming you're not already using OPcache). > That's a REALLY strange assumption to make. Who runs a PHP site where performance is any kind of concern, but doesn't use OPCache? Are these hypothetical people going to fail at that, but succeed at adding an additional step to their deployment process? That seems unlikely. > A new function could be provided to parse a PHP file, but instead of > executing it, the compiled opcode would be saved to a file. It might part of > the OPcache extension if it makes sense, and could be called > opcache_compile_to_file() or something. > I'm not inherently against this as a concept, but again I have to ask: "What problem does this solve?" because it certainly creates a new one. Here's my guess: You want to be able to distribute a library or application without giving your users source code. Apart from being a very non-open thing to do, it's also pointless. Disassembling an opcode stream to PHP source code is trivial. Many folks have tried to "encrypt" such bundles, and they've all been broken, because eventually PHP has to be able to see the bytecodes. Or am I wrong, and there's a motivation I'm just not seeing? -Sara