Sublime Forum

Opening small file now takes noticeably longer?

#11

See here: https://www.sublimetext.com/docs/3/syntax.html#testing

Once the above conditions are met, running the build command with a syntax test or syntax definition file selected will run all the Syntax Tests, and show the results in an output panel.

0 Likes

#12

Thank you for that. Im still a little unclear though - am I supposed to generate my own synax test file for latex?

0 Likes

#13

The latex package already has one, just open it on the default packages, and go to build.

0 Likes

#14

Where is it located? In my ~/Library/Application Support/Sublime Text3/ I only have the following contents:

The Cache/ folder has has LaTeX/ subfolder with:

Am I missing something?

0 Likes

#15

You don’t need to create a syntax file. Just open your LaTeX file and then select Tools > Build System > Syntax Tests.

Then run Tools > Build With… and select Performance. It will measure how long the current LaTeX syntax takes to lex your file, averaged over 10 runs. The UI will hang while it is doing this.

0 Likes

#16

Thanks will! It says:

Syntax “Packages/LaTeX/LaTeX.sublime-syntax” took an average of 9.6ms over 10 runs
[Finished]

Edit: Not sure if this is important, but since reverting to a fresh state, I can’t actually “build” (compile) latex, as I dont have the proper settings anymore.

0 Likes

#17

Well, since it only takes 9.6ms to lex your whole file, it is not the syntax definition that is the issue. There must be something else going on that is affecting performance.

What third-party packages do you have installed, if any?

0 Likes

#18

Right now none. I was using latexing, some themes, etc. I can get a full list by restoring my user folder.

But even in the revert state that 1second delay to open the file is normal? I never seemed to notice it before.

0 Likes

#19

@wbond: to add another data point, I see the same behavior as @diego898.

The first time I open (for example) a latex file after starting ST there is always a brief loading bar (just as his gif shows, and where I had assumed the syntax includes were being recompiled or checked.) This always happens on opening the first latex file after ST loads. It is much shorter than the initial file load that happens when a new version of ST is installed, but still noticeably longer than all subsequent file opens in a given session. It is also much more noticeable on my computer with a slower/older processor.

I see the same behavior on a clean new portable version, so I don’t think it is related to a third party package. I have also observed this behavior for a while in syntaxes that include other syntaxes (possibly since the introduction of sublime-syntax), though I suspect it only started in the LaTeX syntax with the rewrite.

As noted, I had assumed this initial delay was due to a necessary check to verify that none of the syntax includes had been updated or something similar, but it would be great if it could be eliminated.

0 Likes

#20

Alright, thanks for confirming that you are seeing this also. I’ll have to do some digging to see what is going on here. Jon is the expert in performance, but based on some issues I’ve seen recently, memory allocations can be one of the biggest factors.

2 Likes

#21

Interestingly the regex cache (data folder Cache/LaTeX/LaTeX.sublime-syntax.rcache) is 9.4MB! The C++ one is 600K.

I think this is probably what I need to investigate. Most likely restoring all of the syntax memory structures from disk is taking a good chunk of time with LaTeX. This seems also to happen with Objective-C++, although to a lesser degree (5MB).

3 Likes

Opening LaTeX files slower than in Version 2.0
#22

@diego898 do you use SSD, HDD, or HD?

0 Likes

#23

I have an SSD

0 Likes

#24

For reference, I normally run the following packages:

  • Alignment
  • AutoSpell
  • BracketHighlighter
  • File Icons Extended
  • FileBrowser
  • FileDiffs
  • Gist
  • Google Spell Check
  • Latex-cwl
  • Latexing
  • LinkOpener
  • Material Theme
  • Package Control
  • Plain Tasks
  • SidebarEnhancements
  • Theme - Cobalt2
  • Wrap Plus
0 Likes

#25

The source of this is a combination of the current implementation of include rules and the fact that LaTeX includes a whole bunch of other full syntaxes for highlighting inside of code blocks.

This is further compounded by syntaxes that have large regexes for matching identifiers from the stdlib (like Objective-C and PHP), that are then transitively included in multiple other contexts.

I’m looking into optimizations to help improve this moving forward.

5 Likes

#26

ok great! thanks will and everyone else!

0 Likes

#27

Hello again! Just checking to see if there are any updates on this? Is this the best place to check on that or is there a corresponding github issue that I can subscribe to?

Thanks!

0 Likes

#28

I know that Will has made some changes so that the LaTeX regex cache is about 60% of the size it was (it will take effect in the next build). I’m not aware of a GitHub issue tracking this atm.

0 Likes

#29

Thanks kingkeith - is the next build the one AFTER 3126?

0 Likes

#30

yeah :slight_smile: coming soon I think :wink:

0 Likes