Made ProfilerStub return null instead of a dummy ScopedCallback
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 26 Mar 2015 03:50:41 +0000 (20:50 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 26 Mar 2015 03:50:41 +0000 (20:50 -0700)
* This can happen well over 10k times per request due to the message
  hooks. Avoiding the object construction seems prudent.

Change-Id: I45ff7b8c10851f15a25cbea9a2df3669ec21dbd3

includes/profiler/Profiler.php
includes/profiler/ProfilerStub.php

index 69470fd..1c9824a 100644 (file)
@@ -134,7 +134,7 @@ abstract class Profiler {
        /**
         * @param ScopedCallback $section
         */
-       public function scopedProfileOut( ScopedCallback &$section ) {
+       public function scopedProfileOut( ScopedCallback &$section = null ) {
                $section = null;
        }
 
index 5580f94..1d04536 100644 (file)
@@ -28,7 +28,7 @@
  */
 class ProfilerStub extends Profiler {
        public function scopedProfileIn( $section ) {
-               return new ScopedCallback( null ); // no-op
+               return null; // no-op
        }
 
        public function getFunctionStats() {