Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85759 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49361 invoked from network); 9 Apr 2015 15:18:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Apr 2015 15:18:10 -0000 Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.172 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.217.172 mail-lb0-f172.google.com Received: from [209.85.217.172] ([209.85.217.172:36340] helo=mail-lb0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 81/D2-31311-03896255 for ; Thu, 09 Apr 2015 11:18:09 -0400 Received: by lbbqq2 with SMTP id qq2so84958158lbb.3 for ; Thu, 09 Apr 2015 08:18:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=RnHES9YUihdznA/4Uvs/QDxmQcBY9SJp2slM4AbXG1g=; b=XQsNT9ZNg8wunNfkFxtvhpPJzoblxCv2Zt40s6CLyTx/y6/f14cpiKTpLuJ34608Bo jrojZNFjXMA8SVcXcElcJkhY00DxHnd5Nxk2QTjk+qdussEN+4P2Ig8r2z1DUt0LzYbj 1N/K2q5sOTjBklktUb70qto2EUukYcZIb3sVlexwh8Z7lBVgy+cl/l5+qXIKQN/gJE+a Ip+upjoo9MEM4EpYDDX3mWdlLxY/Uq1kSyxzHE7E6pCVnx9v61QXcq6V3PNe0uAb7l6O BuymTLpjotWfH9FEvI98V00Gl/Se8Giqh3KF6EuNBVXns9ahunHyaTDJ2ImYcTGtyQ/Z JuDw== MIME-Version: 1.0 X-Received: by 10.152.5.170 with SMTP id t10mr5118376lat.43.1428592685248; Thu, 09 Apr 2015 08:18:05 -0700 (PDT) Received: by 10.25.90.75 with HTTP; Thu, 9 Apr 2015 08:18:05 -0700 (PDT) Received: by 10.25.90.75 with HTTP; Thu, 9 Apr 2015 08:18:05 -0700 (PDT) In-Reply-To: References: Date: Thu, 9 Apr 2015 11:18:05 -0400 Message-ID: To: jpauli Cc: internals@lists.php.net, Dmitry Stogov Content-Type: multipart/alternative; boundary=089e013d18b08875ba05134c27f8 Subject: Re: [PHP-DEV] Concern around growing complexity in engine - hash table specifically From: ircmaxell@gmail.com (Anthony Ferrara) --089e013d18b08875ba05134c27f8 Content-Type: text/plain; charset=UTF-8 Julien, On Apr 9, 2015 7:52 AM, "Julien Pauli" wrote: > > On Thu, Apr 9, 2015 at 1:01 PM, Dmitry Stogov wrote: >> >> >> >> 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. > > > Yes I know that you - as well as other guys I talked about in my last post - are really open and answer quickly and efficiently to our technical questions, which is a nice point. > > I'm OK to take the lead of such a project. > However, as PHP itself, the project should stay wide open and everyone may have something to say/bring. > > Perhaps time to start a thread about this ? +1 from me. That would go a long way towards mitigating some of these issues. Anthony --089e013d18b08875ba05134c27f8--