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

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Owner

ezimuel commented Nov 21, 2012

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

Maks3w Nov 21, 2012

Member

var name should not start with underscores

@weierophinney

weierophinney Nov 21, 2012

Owner

Our CS allows it; we use it in several places where the functionality is an
implementation detail we want to call out as something to avoid modifying.

On Wednesday, November 21, 2012, Maks wrote:

In 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();

var name should not start with underscores


Reply to this email directly or view it on GitHubhttps://github.com/zendframework/zf2/pull/3045/files#r2198911.

Matthew Weier O'Phinney
matthew@weierophinney.net
http://mwop.net/

@Maks3w

Maks3w Nov 21, 2012

Member

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

@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
Owner

weierophinney commented Nov 26, 2012

Renamed variable on merge, per note from @Maks3w

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment