mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Buffer messages a little, to reduce inter-process communication
This commit is contained in:
parent
543ae4074c
commit
5d39158787
@ -479,8 +479,6 @@ class ProjectAnalyzer
|
||||
}
|
||||
}
|
||||
|
||||
$this->progress->startAnalyzingFiles();
|
||||
|
||||
$this->config->visitStubFiles($this->codebase, $this->progress);
|
||||
|
||||
$plugin_classes = $this->config->after_codebase_populated;
|
||||
@ -491,6 +489,8 @@ class ProjectAnalyzer
|
||||
}
|
||||
}
|
||||
|
||||
$this->progress->startAnalyzingFiles();
|
||||
|
||||
$this->codebase->analyzer->analyzeFiles($this, $this->threads, $this->codebase->alter_code);
|
||||
|
||||
if ($this->parser_cache_provider) {
|
||||
|
@ -136,10 +136,17 @@ class Pool
|
||||
$task_result = $task_closure($i, $task_data);
|
||||
$task_done_message = new ForkTaskDoneMessage($task_result);
|
||||
$serialized_message = $task_done_buffer . base64_encode(serialize($task_done_message)) . PHP_EOL;
|
||||
$bytes_written = @fwrite($write_stream, $serialized_message);
|
||||
|
||||
if (strlen($serialized_message) !== $bytes_written) {
|
||||
$task_done_buffer = substr($serialized_message, $bytes_written);
|
||||
if (strlen($serialized_message) > 200) {
|
||||
$bytes_written = @fwrite($write_stream, $serialized_message);
|
||||
|
||||
if (strlen($serialized_message) !== $bytes_written) {
|
||||
$task_done_buffer = substr($serialized_message, $bytes_written);
|
||||
} else {
|
||||
$task_done_buffer = '';
|
||||
}
|
||||
} else {
|
||||
$task_done_buffer = $serialized_message;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user