class Benchmark (View source)

Traits

Properties

static protected array $macros

The registered string macros.

from  Macroable

Methods

static void
macro(string $name, object|callable $macro)

Register a custom macro.

static void
mixin(object $mixin, bool $replace = true)

Mix another object into the class.

static bool
hasMacro(string $name)

Checks if macro is registered.

static void
flushMacros()

Flush the existing macros.

static mixed
__callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

mixed
__call(string $method, array $parameters)

Dynamically handle calls to the class.

static array|float
measure(Closure|array $benchmarkables, int $iterations = 1)

Measure a callable or array of callables over the given number of iterations.

static array
value(callable $callback)

Measure a callable once and return the result and duration in milliseconds.

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.

Details

static void macro(string $name, object|callable $macro)

Register a custom macro.

Parameters

string $name
object|callable $macro

Return Value

void

static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

static bool hasMacro(string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

static void flushMacros()

Flush the existing macros.

Return Value

void

static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

static array|float measure(Closure|array $benchmarkables, int $iterations = 1)

Measure a callable or array of callables over the given number of iterations.

Parameters

Closure|array $benchmarkables
int $iterations

Return Value

array|float

static array value(callable $callback)

Measure a callable once and return the result and duration in milliseconds.

Parameters

callable $callback

Return Value

array

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.

Parameters

Closure|array $benchmarkables
int $iterations

Return Value

never

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.