Reduced the #calls of rawurlencode() using a cache mechanism #3045

Closed
wants to merge 1 commit into
from

2 participants

@ezimuel
Zend Framework member

This patch reduce the #calls of the rawurlencode() for the Zend\Mvc\Router\Http\Segment->encode(). In the zf2-tutorial application this reduce the rawurlencode() calls from 181 to 48 with a reduction of 1% of the total response time.

@Maks3w Maks3w commented on the diff Nov 21, 2012
library/Zend/Mvc/Router/Http/Segment.php
@@ -25,6 +25,11 @@
class Segment implements RouteInterface
{
/**
+ * @var array Cache for the encode output
+ */
+ private static $__cacheEncode = array();
@Maks3w
Zend Framework member
Maks3w added a line comment Nov 21, 2012

var name should not start with underscores

@weierophinney
Zend Framework member
weierophinney added a line comment Nov 21, 2012
@Maks3w
Zend Framework member
Maks3w added a line comment Nov 21, 2012

For me the private visibility is enough since forbid "unauthorized" modifications in extended classes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@weierophinney weierophinney added a commit that referenced this pull request Nov 26, 2012
@weierophinney weierophinney [#3045] Rename private variable
- Remove double underscore prefix
fd07e64
@weierophinney weierophinney added a commit that referenced this pull request Nov 26, 2012
@weierophinney weierophinney Merge branch 'hotfix/3045' into develop
Forward port #3045
791cb40
@weierophinney weierophinney added a commit that closed this pull request Nov 26, 2012
@weierophinney weierophinney Merge branch 'hotfix/3045'
Close #3045
c00c516
@weierophinney
Zend Framework member

Renamed variable on merge, per note from @Maks3w

@ghost Unknown pushed a commit that referenced this pull request Jul 14, 2013
@weierophinney weierophinney [#3045] Rename private variable
- Remove double underscore prefix
b3b6b45
@ghost Unknown pushed a commit that referenced this pull request Jul 14, 2013
@weierophinney weierophinney Merge branch 'hotfix/3045'
Close #3045
aa1004e
@ghost Unknown pushed a commit that referenced this pull request Jul 14, 2013
@weierophinney weierophinney Merge branch 'hotfix/3045' into develop
Forward port #3045
26ba811
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment