Re: svn: /phd/trunk/phpdotnet/phd/ Index.php Package/Default/ChunkedXHTML.php

From: Date: Tue, 28 Jul 2009 08:02:04 +0000
Subject: Re: svn: /phd/trunk/phpdotnet/phd/ Index.php Package/Default/ChunkedXHTML.php
References: 1  Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-4538@lists.php.net to get a copy of this message
2009/7/28 Moacir de Oliveira Miranda Júnior <moacir@php.net>: > moacir                                   Tue, 28 Jul 2009 05:42:02 +0000 > > Revision: > http://svn.php.net/viewvc?view=revision&revision=286440 > > Log: > dbhtml filename support > > Changed paths: >    U   phd/trunk/phpdotnet/phd/Index.php >    U   phd/trunk/phpdotnet/phd/Package/Default/ChunkedXHTML.php > > Modified: phd/trunk/phpdotnet/phd/Index.php > =================================================================== > --- phd/trunk/phpdotnet/phd/Index.php   2009-07-28 05:40:25 UTC (rev 286439) > +++ phd/trunk/phpdotnet/phd/Index.php   2009-07-28 05:42:02 UTC (rev 286440) > @@ -70,6 +70,9 @@ >     ); >     private $mytextmap = array( >     ); > +    private $pihandlers = array( > +        'dbhtml'            => 'PI_DBHTMLHandler', > +    ); >     private $chunks    = array(); >     private $isChunk   = array(); >     private $previousId = ""; > @@ -110,6 +113,7 @@ >                 if ($value) { >                     $this->registerElementMap(static::getDefaultElementMap()); >                     $this->registerTextMap(static::getDefaultTextMap()); > +                    $this->registerPIHandlers($this->pihandlers); Shouldn't they use similar registration procses as the element/textmaps? That way we could overwrite/merge them in inherited formats.. >                 } >                 break; >             case Render::INIT: > @@ -291,12 +295,16 @@ >             return false; >         } >         if (array_pop($this->isChunk)) { > -            array_pop($this->chunks); > +            $lastchunk = array_pop($this->chunks); >             $this->currentchunk = end($this->chunks); > +            $dbhtml = $this->getPIHandler("dbhtml"); Rather then retrieving the object on every single chunk (that'll be over 8000 method calls...), how about making that variable static? Something like: static $dbhtml = null; if (!$dbhtml) { $dbhtml = $this->getPIHandler("dbhtml"); } > +            if ($dbhtml->getAttribute("filename")) { > +                $this->nfo[$lastchunk]["filename"] = > $dbhtml->getAttribute("filename"); And rather then making the exact same method call twice in a row, please do something like: $filename = $dbhtml->getAttribute("filename"); if ($filename) { $this->nfo[$lastchunk]["filename"] = $filename; } We really need to watch the overhead in the methods that are called few thousands times... -Hannes

« previous php.doc.cvs (#4538) next »