sublime_text
sublime_text copied to clipboard
ST4 save of many files is slow compared to ST3
Description of the bug
The replace-in-files is very slow in ST4 when compared to ST3, in a range of 120'' to 2' for the biggest task used for testing. The delay appears is in the saving of the files opened for the replacement:
- ST3 UI freezes, but finishes very fast
- ST4 UI does not freeze, you can see both the name of each saved file in the status bar, and the change of the "save pending" dot to the "saved" cross in the file's tab or "Files list" sidebar. But it is very slow (>120' for the 7.000 files test).
Steps to reproduce
Replace-in-files \A(.) with \1 in about 7.000 files that are thus opened. Select File - Save all. About 2' in ST3, >120' in ST4 in my setup. My files 1-byte-character text in Windows 1252 encoding, totalling about 7 million lines
Expected behavior
ST4 as fast as ST3 in saving
Actual behavior
ST4 very slow in comparison, as described above
Sublime Text build number
4126 for ST4, 3211 for ST3
Operating system & version
Tested in Windows 11 and Windows 7
(Linux) Desktop environment and/or window manager
No response
Additional information
The ST3 is my usual one (licensed, updated). The ST4 is a new install. I ran the ST4 tests in normal and safe mode, with no difference.
The tests have been performed in two workstations, a new Windows 11, 16 core, 32Gb. And the previous workstation, Windows 7, 8 core, 16Gb.
In both, same test (ST3 and ST4), and the results are the same (in the Windows 7 machine both tests run slower than in the Windwos 11 one, but ST4 very much slower than ST3 on both).
OpenGL context information
No response
Maybe a timer can be used to update status bar messages with an interval of 1 second, so not each saved file is printed individually.
That sounds as a possible solution. If a FIFO with the return status of the multiple saving-worker's has been used, and the FIFO is used for a one-by-one report by the UI-thread ...
I wondered if this is an enhancement, as marked, or a bug, as it makes ST4 certainly lose one very useful feature of ST3, the lightning-fast find-replace-save-close cycle on thousands of files.
One second though about the timer idea: if a FIFO is used for the receiving the "work done" message of the threaded workers, then a simpler "count modulus 100" may be used for emitting just a fraction of the status updates ...
From my testing on Linux ST4 is about as fast at fully completing the replacement, but ST3 will create the tabs and be "responsive" (it lags a whole lot but is still interactive) while the replacements are completed in the background. There are some improvements for this in the works, though really a proper solution that doesn't force every file to be opened in ST would be ideal.