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

Commit bdba5c2

Browse files
committed
[signals] Revert previous patch
- After extensive benchmarks, discovered previous patch was actually slower in all cases except closures, and < 1% faster in that case. Reverted.
1 parent b6d0ce1 commit bdba5c2

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

src/SignalHandler.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -117,24 +117,7 @@ public function getCallback()
117117
public function call(array $args = array())
118118
{
119119
$callback = $this->getCallback();
120-
121-
// Following is a performance optimization hack. call_user_func() is up
122-
// to 6x faster than call_user_func_array(), and since signal handlers
123-
// will be called potentially dozens to hundreds of times in an
124-
// application, this optimization makes sense.
125-
//
126-
// We can potentially expand the number of case statements if we find
127-
// many instances where we're using more arguments.
128-
switch (count($args)) {
129-
case 1:
130-
return call_user_func($callback, $args[0]);
131-
case 2:
132-
return call_user_func($callback, $args[0], $args[1]);
133-
case 3:
134-
return call_user_func($callback, $args[0], $args[1], $args[2]);
135-
default:
136-
return call_user_func_array($callback, $args);
137-
}
120+
return call_user_func_array($callback, $args);
138121
}
139122

140123
/**

0 commit comments

Comments
 (0)