mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 13:51:54 +01:00
Performance: cut the selected_text from snippet
instead of from full text 50% faster than cutting from full text, improves performance up to 3% depending on file length and number of errors in file
This commit is contained in:
parent
b5a0c5926b
commit
cb78f54d8a
@ -296,7 +296,9 @@ class CodeLocation
|
||||
}
|
||||
|
||||
$this->snippet = mb_strcut($file_contents, $this->preview_start, $this->preview_end - $this->preview_start);
|
||||
$this->text = mb_strcut($file_contents, $this->selection_start, $this->selection_end - $this->selection_start);
|
||||
// text is within snippet. It's 50% faster to cut it from the snippet than from the full text
|
||||
$selection_length = $this->selection_end - $this->selection_start;
|
||||
$this->text = mb_strcut($this->snippet, $this->selection_start - $this->preview_start, $selection_length);
|
||||
|
||||
// reset preview start to beginning of line
|
||||
if ($file_contents !== '') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user