I use SciTE 4.2.0 64-bit on Windows 10 1903.
I have a two megabyte, 40-thousand-lines text file with no syntax highlighting, no special characters and no excessively long lines. Making a rectangular (using Shift+Alt+click) spanning all the lines takes about a minute on an i7, with one core utilized fully and a "not responding"message in the title bar.
Why does this take so long? Could it be improved?
Its laying out the text on each line to work out where the left and right side are as document positions. Much of the time is in setting up a graphics context which is done twice per line.
Retaining a graphics context over the whole operation could speed it up but that breaks through the current layering. That would leave MeasureWidths as the main cost and that can be reduced by increasing the level of caching with
cache.layout=3.Here's part of a profile:
Thank you for your analysis!
I was editing the result of "dir /b /s", removing the common directory prefix. Since the selection in every line is identical, would it be feasible to reuse the previously measured width?
Performing the detection would also take time for what I expect would be a rare case. Long columns of differing values from a database dump or similar would be the more common case.
Detecting that the selection is the same on each line requires resolving the selection to positions which is the costly operation. So, what you probably want to do is determine the positions on the first line then check if each line has that much of a common prefix. I don't think this approach is worth the additional complexity.
If there is no easy solution, I'm okay with closing this as "won't fix".
Search&replace is an obvious alternative for my task.
It is quite likely that performance can be improved in some way even if I can't see a good direction currently. Caching tends to get slathered on every performance problem so there's likely some way to use it here.
Someone else may want to work on this issue so I'll leave it open.
Performance improved by reusing surface with [703e30].
For a 100 MB file containing repeated copies of SciTEBase.cxx, selecting first 80 pixels of each of the first 1,000,000 lines took 64 seconds and now takes 17 seconds on a 3.4 GHz i7-6700.
Syntax highlighting improves speed as the widths of lexemes are cached so there will be less improvement to files without syntax highlighting.
Here's the most significant part of a profile after the change:
Performance can always be seen as a problem, no matter how fast. I am marking this issue as fixed.
Related
Commit: [703e30]
Performance improved by reusing surface with [703e30].
For a 100 MB file containing repeated copies of SciTEBase.cxx, selecting first 80 pixels of each of the first 1,000,000 lines took 64 seconds and now takes 17 seconds on a 3.4 GHz i7-6700.
Syntax highlighting improves speed as the widths of lexemes are cached so there will be less improvement to files without syntax highlighting.
Here's the most significant part of a profile after the change:
Performance can always be seen as a problem, no matter how fast. I am marking this issue as fixed.
Related
Commit: [703e30]