Profiler: remove unnecessary checks
authorKevin Israel <pleasestand@live.com>
Fri, 23 Aug 2013 07:11:14 +0000 (03:11 -0400)
committerAaron Schulz <aschulz@wikimedia.org>
Sun, 25 Aug 2013 22:46:55 +0000 (22:46 +0000)
Should slightly reduce overhead.

Change-Id: Iff71041f1cbc12b0d28f24752a01c63456cb9eaf

includes/profiler/Profiler.php

index 5346c34..41a9d60 100644 (file)
@@ -34,8 +34,8 @@ function wfProfileIn( $functionname ) {
        if ( Profiler::$__instance === null ) { // use this directly to reduce overhead
                Profiler::instance();
        }
-       if ( Profiler::$__instance && !( Profiler::$__instance instanceof ProfilerStub ) ) {
-               Profiler::instance()->profileIn( $functionname );
+       if ( !( Profiler::$__instance instanceof ProfilerStub ) ) {
+               Profiler::$__instance->profileIn( $functionname );
        }
 }
 
@@ -47,8 +47,8 @@ function wfProfileOut( $functionname = 'missing' ) {
        if ( Profiler::$__instance === null ) { // use this directly to reduce overhead
                Profiler::instance();
        }
-       if ( Profiler::$__instance && !( Profiler::$__instance instanceof ProfilerStub ) ) {
-               Profiler::instance()->profileOut( $functionname );
+       if ( !( Profiler::$__instance instanceof ProfilerStub ) ) {
+               Profiler::$__instance->profileOut( $functionname );
        }
 }
 
@@ -77,7 +77,7 @@ class ProfileSection {
                if ( Profiler::$__instance === null ) { // use this directly to reduce overhead
                        Profiler::instance();
                }
-               if ( Profiler::$__instance && !( Profiler::$__instance instanceof ProfilerStub ) ) {
+               if ( !( Profiler::$__instance instanceof ProfilerStub ) ) {
                        $this->enabled = true;
                        Profiler::$__instance->profileIn( $this->name );
                }