Home Download Buy Blog Forum Support

Sublime Text performance with very large files

Sublime Text performance with very large files

Postby timfennis on Tue Apr 23, 2013 9:32 am

Hey guys.

Me and my colleague are always discussing many different IDE's and text editors. I am a big sublime text fan, and he pretty much hates everything. One of the problems we had with sublime text is that it's really slow at loading very big files. Our example use-case was opening a 50MB .sql file. In my opinion this is not a valid usecase for a text editor but according to him it is.

Other editors seem to load the file withing a few seconds. For example: EditPlus and SciTE (based on scintilla). What is the reason sublime text is so slow with large files? Any information that could add to this discussion is welcome.

Thanks for your time.
Posts: 1
Joined: Tue Apr 23, 2013 9:26 am

Re: Sublime Text performance with very large files

Postby Narretz on Tue Apr 23, 2013 1:20 pm

AFAIR it has to do with the symbol indexing Sublime does when loading a file. Loading is faster in ST3, have you tried that?
Posts: 44
Joined: Mon Feb 04, 2013 5:33 pm

Re: Sublime Text performance with very large files

Postby wbond on Tue Apr 23, 2013 9:20 pm

Yes, what Narretz says is true. I believe Jon significantly improved the performance for large files if you switch to "Plain Text" syntax in ST3 so that it does not need to use regex (that is what syntax defs use) to parse the file.
Posts: 568
Joined: Mon Feb 28, 2011 5:33 am

Re: Sublime Text performance with very large files

Postby qgates on Wed Apr 24, 2013 2:13 am

I believe it is mostly to do with syntax colouring. Sublime along with textmate are both particularly sophisticated in this area, allowing things like context specific colouration / syntax selection. Both are slow with large files, due to their heavy dependence on regexs. In addition, Sublime has the minimap which requires everything to be coloured correctly in realtime, making lazy colouring more difficult. Large edits on large colourised files will be particularly slow, as will undos, and large amounts of multi-cursor edits will exaggerate things. Forcing sublime to turn off colourisers with "plain text" should speed things up alot.

Sublime 3 has improved in this area, though it would be nice to be able to disable colouring by default in certain situations (per session ie. View.. disable auto colourising) or to make this a setting available as either a global, per-project or per-file setting. Rather than doing it "after the fact".

I wonder if S3 has moved to doing this on a background thread (or will), so you can get working with your large files right away while the thread parsers through and applies the colouring. From what I've gleaned, the symbol indexing thing only happens when folders are added to the project, so this shouldn't be an issue if the project's empty.
Posts: 277
Joined: Mon Nov 05, 2012 4:33 pm

Re: Sublime Text performance with very large files

Postby unphased on Mon Feb 03, 2014 3:12 pm

There should be a simple configuration option (an integer number of bytes. Say, 10*1024*1024 or 10MB) which either controls whether a file above that size will not have syntax regexes applied, or for which all files only get syntax regexes run over that initial segment of the file. So say you have a 30MB file with this setting, only the first third of the file gets highlighted.

I have already noticed a limit of this sort which ST3 applies to very very long lines. It will refuse to syntax highlight lines that are longer than some particular length. This may or may not be limited to XML files which was what I noticed this on first. We need only to extend this concept to the lines of the file itself.
Posts: 29
Joined: Thu May 17, 2012 5:16 am

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 15 guests