/usr/share/php/kohana3.1/modules/codebench/classes/bench/userfuncarray.php is in libkohana3.1-mod-codebench-php 3.1.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | <?php defined('SYSPATH') or die('No direct access allowed.');
/**
* @package Kohana/Codebench
* @category Tests
* @author Woody Gilk <woody.gilk@kohanaphp.com>
*/
class Bench_UserFuncArray extends Codebench {
public $description =
'Testing the speed difference of using <code>call_user_func_array</code>
compared to counting args and doing manual calls.';
public $loops = 100000;
public $subjects = array
(
// Argument sets
array(),
array('one'),
array('one', 'two'),
array('one', 'two', 'three'),
);
public function bench_count_args($args)
{
$name = 'callme';
switch (count($args))
{
case 1:
$this->$name($args[0]);
break;
case 2:
$this->$name($args[0], $args[1]);
break;
case 3:
$this->$name($args[0], $args[1], $args[2]);
break;
case 4:
$this->$name($args[0], $args[1], $args[2], $args[3]);
break;
default:
call_user_func_array(array($this, $name), $args);
break;
}
}
public function bench_direct_call($args)
{
$name = 'callme';
call_user_func_array(array($this, $name), $args);
}
protected function callme()
{
return count(func_get_args());
}
}
|