Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85751 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27016 invoked from network); 9 Apr 2015 11:01:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Apr 2015 11:01:23 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.216.50 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.216.50 mail-vn0-f50.google.com Received: from [209.85.216.50] ([209.85.216.50:42103] helo=mail-vn0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FE/01-17490-20C56255 for ; Thu, 09 Apr 2015 07:01:22 -0400 Received: by vnbf129 with SMTP id f129so20114380vnb.9 for ; Thu, 09 Apr 2015 04:01:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=i3Kl7Y9lsNENUAiHJAJVj9qb6A+60/q2ONkszDK1d1g=; b=adzN/8OsJ/Z/uPyWqlVyzYtU0OP9D5DtsdO5W7C4671sFabMXb2V44X1XtrF3ix4wA bXdS3TpaCBXU8bvm98SglVQ4Z2nylz7JvLzHaWZvGEmPXnhvuAA8TDwLbS7B7JNyj0Qu 6lkjhSYItVfL0lC+PqC8hIh+XMWwXUe8eAayIltO0wicj3DSqFCIfARNULIgNw5kkv0m aYjKNQHV7jQ8UjuesywZila+n+zuWEPeczjRfUQe0zaCx7zZW0Vm+MGFdHv7MO7HvZqU KYybSKZzekQH76eCAr1JS+kf/q/8SQjyiRQg4kHiRk7m0kI9iRGXAxoHpMAFsW7bVFLi mueQ== X-Gm-Message-State: ALoCoQl/76P2RLznrIWGj6N7XWedWfCxdYYM2fqRgGcFOmAQik9u91LznxfFQK+jgOVIhRMmOfTV/mcHxDQvQyYkz/3wdOQ7LaGsv5Rb2XGrLNs6E/gcWOB3h9N/76dbbgjpkEnbT4fTWK1iy9t71xvYZj9G42jadA== MIME-Version: 1.0 X-Received: by 10.52.157.72 with SMTP id wk8mr23247613vdb.12.1428577279158; Thu, 09 Apr 2015 04:01:19 -0700 (PDT) Received: by 10.52.248.36 with HTTP; Thu, 9 Apr 2015 04:01:19 -0700 (PDT) In-Reply-To: References: Date: Thu, 9 Apr 2015 14:01:19 +0300 Message-ID: To: Julien Pauli Cc: Anthony Ferrara , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e016338ee4247470513489198 Subject: Re: [PHP-DEV] Concern around growing complexity in engine - hash table specifically From: dmitry@zend.com (Dmitry Stogov) --089e016338ee4247470513489198 Content-Type: text/plain; charset=UTF-8 On Thu, Apr 9, 2015 at 1:35 PM, Julien Pauli wrote: > On Wed, Apr 8, 2015 at 10:55 PM, Dmitry Stogov wrote: > >> On Fri, Apr 3, 2015 at 9:57 PM, Anthony Ferrara >> wrote: >> >> > All, >> > >> > I spent a little bit of time today trying to debug an issue with 7 >> > that Drupal 8 was facing, specifically regarding an array index not >> > behaving correctly ($array["key"] returned null, even though the key >> > existed in the hash table). >> > >> > I noticed that the hash table implementation has gotten orders of >> > magnitude more complex in recent times (since phpng was merged). >> > >> > Specifically, that ardata and arhash are now the same block of memory, >> > and that we're now doing negative indexing into arData to get the hash >> > map list. From Dmitry's commit message, it was done to keep the data >> > that's accessed most often in the same CPU cache line. While I am sure >> > that there are definitive performance gains to doing this, I do worry >> > about the development and debugging costs of this added complexity. >> > >> > As well as the way it increases the busfactor of the project. >> > >> > There is definitely a tradeoff there, as the change is pretty well >> > encapsulated behind macros. But that introduces a new level of >> > abstraction. But deeper than that it really makes debugging with gdb a >> > pain in the neck. >> > >> > Without hard data on this particular patch, I'm not suggesting we roll >> > back the change or anything. I more just want to express concern with >> > the trend lately to increase complexity significantly on developers >> > for the sake of performance. >> > >> >> > While I'm definitely not saying performance doesn't matter, I also >> > think performance at all costs is dangerous. And I wonder if some of >> > the more fundamental (even if isolated) changes such as this should be >> > way more documented and include the performance justification for >> > them. I'm definitely not suggesting an RFC, but perhaps some level of >> > discussion should be required for these sorts of changes... >> > >> >> > I agree with Anthony. > > Many things however can be solved with a nice .gdbinit. > We already have dump_ht() , dump_htptr() , f.e , that I'm using heavilly > to debug HT in PHP5. > Not talking about dump_bt(). > > I think one step is to improve our .gdbinit with many more features, and > obviously port the actual ones to work with PHP7. > > A second step is documentation. > > Anthony, you know about our project phpinternalsbook.com, don't you ;-) > There has been recent discussions on IRC to actually merge this project > under php.net. > > I'm really feeling enthusiast about helping or even taking the lead of > such a project : I would like php.net to hold a real, detailed > documentation about internals. > > I think with PHP7 should come an internal documentation, somewhere behind > php.net , that will explain to a C-aware developper our main internal > structures and choices, especially about performance optimisations. > > Have you had a look at the new Zend Memory Manager ? It has become > insanely complex, with many performance-turned code. > Same, but in a lower footprint, for the executor : the executor stack > frame has really changed from PHP5's one, and is also not very easy to > debug (with a long alloced buffer shrinked with many pointer tricks that > needs you to have a complete image of the memory buffer in your head). > > I won't be able myself to document all those tricks, because I'm not the > author of them. > I think Zend, through Dmitry, Nikic, Bob or Laruence , should help us > understanding some concepts, if they are not around to help with the doc. > Hi Julien, It would be great, if you lead PHP-7 internals documentation project. You are always welcome with questions about implementation details. I may also take care about documenting some features in more or less complete form. Thanks. Dmitry. > > > Julien.Pauli > --089e016338ee4247470513489198--