wbond wrote:I believe part of the issue is that Sublime Text uses language syntax definitions that are based on regular expressions, so it depends on how efficient the regular expressions for a given language are. I've definitely noticed slowdowns opening files with 50K lines and changing the syntax to SQL and using 50K cursors to do batch edits. Then again, I don't expect good performance since that is kind of an insane number of operations being done with each keypress.
I would imagine with longer files it may be possible to highlight the file more incrementally, but it may not be optimized for longer lines. Additionally, I imagine the regular expression engine used would need to support multiple cores in order to see such usage. I doubt Jon wrote his own regex engine, although it isn't out of the realm of possibility.
There is certainly a performance penalty in using complex regex's in real time to perform syntax colouring; my guess is that Sublime uses python's native regex facilities. However I don't think that's the issue here
. The problems above:
- Concern long lines, not big files per se
- Happen irrespectively of whether we're in "plain text" syntax. Performance issues relating to syntax colouring are typically addressed by switching to plain text (no colouring)
- Are irrespective of whether any kind of wrapping is happening
- Happens in ST2 and ST3, with performance degradation similar in both; ST3 imposes a line length threshold for disabling colouring, whereas ST2 doesn't. Yet ST3 sees no performance improvement over ST2 as line length increases, even beyond the threshold - see my post above.
While there are definitely performance issues connected with colouring algorithms and regex's, this issue is likely down to the way ST handles text internally. What I'd like to see:
1. Some improvements in ST's core for handling large files and long lines. Most editors handle this fine and Sublime shouldn't be the exception. At the moment a lack of threading combined with what feels like clunky long line behaviour is a PITA and requires me to fire up other editors for handling big mysql dumps etc..
2. The ability to fine tune or disable the line-length threshold at which ST3 turns off colouring. ST2 doesn't have a limit that I've seen, and there's no performance drop with colouring enabled on really long lines in ST2.
3. (related, nice to have) A high-priority UI, perhaps on the status bar, that provides a progressbar and "cancel" button for any time consuming operations. Sublime can freak me out when it becomes totally unresponsive working on a larger file and I do a particular SnR or some other action. I've no way to know beforehand the actions that will lock up the UI and those that'll be quick. Ideally the UI should always be responsive, even if the core is tied up doing something, at least for progress display and cancel option.