1
0
Fork 0

some micro-optimizations made

refs issue #3657
pull/3685/head
Xavier Fornes 2015-01-28 14:43:58 +01:00
parent a4ffda699f
commit 2936dc0e55
1 changed files with 5 additions and 10 deletions

View File

@ -96,16 +96,11 @@ class ConsoleIO extends BaseIO
public function write($messages, $newline = true)
{
if (null !== $this->startTime) {
$messages = (array) $messages;
$startTime = $this->startTime;
$messages = array_map(function ($message) use ($startTime) {
return sprintf(
'[%.1fMB/%.2fs] %s',
memory_get_usage() / 1024 / 1024,
microtime(true) - $startTime,
$message
);
}, $messages);
$memoryUsage = memory_get_usage() / 1024 / 1024;
$timeSpent = microtime(true) - $this->startTime;
$messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
return sprintf('[%.1fMB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
}, (array) $messages);
}
$this->output->write($messages, $newline);
$this->lastMessage = join($newline ? "\n" : '', (array) $messages);