Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

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

Closed
wants to merge 1 commit into from

Conversation

ezimuel
Copy link
Contributor

@ezimuel 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.

@@ -25,6 +25,11 @@
class Segment implements RouteInterface
{
/**
* @var array Cache for the encode output
*/
private static $__cacheEncode = array();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var name should not start with underscores

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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//pull/3045/files#r2198911.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

weierophinney added a commit that referenced this pull request Nov 26, 2012
- Remove double underscore prefix
weierophinney added a commit that referenced this pull request Nov 26, 2012
@weierophinney
Copy link
Member

Renamed variable on merge, per note from @Maks3w

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants