Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74357 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62539 invoked from network); 19 May 2014 12:02:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 May 2014 12:02:13 -0000 Authentication-Results: pb1.pair.com smtp.mail=arvids.godjuks@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=arvids.godjuks@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.44 as permitted sender) X-PHP-List-Original-Sender: arvids.godjuks@gmail.com X-Host-Fingerprint: 209.85.192.44 mail-qg0-f44.google.com Received: from [209.85.192.44] ([209.85.192.44:48254] helo=mail-qg0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6E/30-55232-922F9735 for ; Mon, 19 May 2014 07:59:38 -0400 Received: by mail-qg0-f44.google.com with SMTP id i50so8672059qgf.31 for ; Mon, 19 May 2014 04:59:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=woVt/XHDhu60KdY2ey3rnYb0mV8gTzFuS1TFjeJNed8=; b=S+IeLSDl+G96Fst0CO9oadIJserUByySm+ea6cLuPnGvN++rs2HPukIj5c9DGykFx1 N3/xXcFqJjER6X234HPXr8vMljXzMLhvRHjdYNZGjh3z2f00IgnY3kWn9MShkLhqv2E/ lQmVdnAFPtHMu+ES4P8isCBJ55AS+MkRYICAv92f2g5DrHN25jgBnzl23Qb14PbLJbJ1 AnylISVJGCTqquM3WIwhtFSK9LMzeW92VWhQuKWoY9AUtVSpcERQ6KifDZhbwKBv5zNs E3eQd/hnGcrmJCzt8bYfCSeSSjZe4iR65lizs2Iyk9WJjHh7kO2KKijNFuBzG7dBfnfZ X9GQ== X-Received: by 10.140.84.168 with SMTP id l37mr46816368qgd.104.1400500775274; Mon, 19 May 2014 04:59:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.97.246 with HTTP; Mon, 19 May 2014 04:59:15 -0700 (PDT) In-Reply-To: References: Date: Mon, 19 May 2014 14:59:15 +0300 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=001a11c1170837ce3604f9bf7f8a Subject: Re: [PHP-DEV] Re: 64bit and phpng, votes and plans From: arvids.godjuks@gmail.com (Arvids Godjuks) --001a11c1170837ce3604f9bf7f8a Content-Type: text/plain; charset=UTF-8 Hello internals! I was following this 64 bit stuff from the get go, and been monitoring the PHPNG stuff as it was announced, so I think I have a pretty clear picture of what's happening. At least I belive so :) And I'm a userland developer, so I'm not into compilers and low-level C stuff, just have the basic understanding and principles at hand. So, to the point of my message. I have a question that is nugging me for weeks now about the 64 bit stuff and how 64 bit processors are handling things. There is no debate that a 64 bit pointer or integer takes double the memory than a 32 bit one, and actually direct comparation gives us a frightening answer - it's doubled! In reality 10 years later we know that it's not that bad (it's common knowlege). My main question is - isn't 2 32 bit integers, stuck into one 64 bit register, handled slower than 2 64 bit integer each occupying it's own register? I'm concerned with the fact, that some of you are so fixated on the memory consumption aspect without any regard to the CPU cycle part of the equasion. It was pointed out by Pierre, and largely ignored, by the vocal advocates for the PHPNG, that despite the change of many 32 bit types to 64 bit it not just didn't degrade the performance (hello, 64 bit processors, no? They by design are more efficient with 64 bit than with 2 32 bit numbers stuck into a 64 bit register), but actually improved it. IMPROVED THE PERFORMANCE. This is logical, this is what you expect optimizing for 64 bit mode. And because of the PHP 5.4 memory reduction (interned strings, if i'm not mistaken?) memory growth is almost non-existent. A 2% to 5% increase in memory usage agains 5.5 after a 30% to 70% memory usage drop in 5.4 is, from my point of view, a drop in the ocean. And PHPNG is a PoC at this point: not optimized, no advanced features implemented, etc. Hell, it's a JIT engine, maybe after initial release you will find a way to minimize thouse ZVAL structures in a way, that it will cut down the memory usage on them much more that you have introduced with 64 bit patch with those size_t types. The future proofing side was mentioned only a few times and I actually want to point this out - memory is growing like crazy - DDR4 is already being shipped, server platforms for DDR4 are being introduced this summer. First DDR4 modules are already surpasing the DDR3 capacity with ease. And data amounts, we are handling in our PHP applications, also grows a lot. Yes, I agree that an array of 2^64 bit elements probably will not be handled by PHP anytime soon, but did you concider the fact that an array's key, indexed by an ID column from the database, can easilly be bigger than 32 bit unsigned integer (I tend to put 64 bit integers as my primary keys these days)? Will it error out if you use a 32 bit array length integer or should you actually use a 64 bit one in this case? At least no one is objecting that we need > 4GB file support. For me, as a userland developer, this future proofing and concictensy, with the slight performance speedup, is much more important that a 2 to 5% memory usage increase. And PHPNG, when actually done and optimized, will bring much more improvement than cutting down this 64 bit patch in half. Most of us have memory to spare on our servers, especially when running a nginx + php-fpm setup. And those, who have memory problems, probably use wrong tool for the job (or poorly designed software). The history shows, that PHP had it's major problems with half-baked solutions or cut down implementations due to politics and obsessive behaviour over some parts of it. I though PHP had it's share of trouble with register_globals and many other bad decisions and now, at least from my point of view, another bad decision is forced on, this time by the Zend itself (at least it looks that way). For god's sake - you make a JIT for PHP. Implement god damn typehints for scalars and optimize the memory usage with JIT optimizations, but leave the room for the manouver for the future. Think also about the extensions - from their point of view using a consistent type is much easier across the board. My 0.02$, thanks. --001a11c1170837ce3604f9bf7f8a--