Benchmark
class Benchmark
Traits
Properties
| static protected array | $macros | The registered string macros. |
from Macroable |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Measure a callable once and return the result and duration in milliseconds.
Flush all static state.
Details
in
Macroable at line 30
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 44
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 61
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 72
static void
flushMacros()
Flush the existing macros.
Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 83
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 108
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 22
static array|float
measure(Closure|array $benchmarkables, int $iterations = 1)
Measure a callable or array of callables over the given number of iterations.
at line 49
static array
value(callable $callback)
Measure a callable once and return the result and duration in milliseconds.
at line 65
static never
dd(Closure|array $benchmarkables, int $iterations = 1)
Measure a callable or array of callables over the given number of iterations, then dump and die.
at line 77
static void
flushState()
Flush all static state.