8000 Improve memory efficiency · symfony/symfony@c1df9f2 · GitHub
[go: up one dir, main page]

Skip to content

Commit c1df9f2

Browse files
author
Dword123
committed
Improve memory efficiency
This avoids concatenating `$message` and `PHP_EOL` (if necessary) as a new value, greatly improving memory efficiency for large `$message`s.
1 parent 00763f6 commit c1df9f2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Console/Output/StreamOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function getStream()
7070
*/
7171
protected function doWrite($message, $newline)
7272
{
73-
if (false === @fwrite($this->stream, $message.($newline ? PHP_EOL : ''))) {
73+
if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) {
7474
// should never happen
7575
throw new \RuntimeException('Unable to write output.');
7676
}

0 commit comments

Comments
 (0)
0