Created
July 3, 2018 12:32
-
-
Save fridzema/48e599eafebc72eeb26df878d12d0e73 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function handle() | |
{ | |
$timings = []; | |
$results = []; | |
$loops = 10; | |
$bar = $this->output->createProgressBar($loops); | |
for($i = 1; $i <= $loops; $i++){ | |
$start = microtime(true); | |
Contact::select('id')->get(); | |
$timings[] = microtime(true) - $start; | |
$bar->advance(); | |
} | |
$bar->finish(); | |
$this->comment(''); | |
$average = array_sum($timings) / count($timings); | |
$results[] = [ | |
Cache::get('last_test_result'), | |
$average, | |
(Cache::has('last_test_result')) ? (Cache::get('last_test_result') - $average) : 0 | |
]; | |
$headers = ['last', 'current', 'difference']; | |
$this->table($headers, $results); | |
Cache::forever('last_test_result', $average); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment