Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow performance on multi-file project and not respecting .texlabroot or texlabroot files? #1041

Open
a-torgovitsky opened this issue Mar 12, 2024 · 2 comments

Comments

@a-torgovitsky
Copy link

I have a large and complex project that makes extensive use of the subfiles package.
The structure is basically:

├── chapter1
├── chapter2
├── chapter3
├── common
├── main.tex

where each of the chapter directories has the structure

├── chapter1
│   └── problems
│       ├── problem1
│       │   problem1.tex
│       ├── problem2
│       │   problem2.tex
|      [many more problem directories]
│   └── chapter1.tex

When working on a subfile, like chapter1.tex or problem1.tex, texlab has a long delay (10 seconds or more) before it is able to provide completion suggestions.
I'm guessing this is because my directory structure is very challenging, with many nested \inputs, etc, and many large files.
So I don't really have any expectation that I should be getting project-wide completion quickly.
Consistent with this, the texlab process is taking about 1.4GB of memory.

However, two things that I do find perplexing:

  1. When the completion does come up, it finds some things, but not everything from the project. The keys in the current file seem to always be there, and then there are some from other files in the project, but definitely not all. I can't discern any pattern other than that.
  2. The speed of completion (and suggesting some keys from other files) is not affected by whether I put an empty .texlabroot or texlabroot file in the subdirectory of the subfile (e.g. chapter1 above). From my reading of the Wiki on root directory, I thought that putting such a file in the subfile directory would tell texlab not to search farther up the tree, and so speed up completion. Am I misunderstanding how the root detection works?

This is on texlab v.5.13.0 being used with Neovim, however I have also tried in VS-code and find the same behavior. I don't have any issues with texlab when working on other, smaller projects.

@pfoerster
Copy link
Member

When the completion does come up, it finds some things, but not everything from the project. The keys in the current file seem to always be there, and then there are some from other files in the project, but definitely not all. I can't discern any pattern other than that.

Have you scanned the initial list returned by the completion list or have you typed a few characters and then checked the list? The server initially only returns at most 50 items to keep the completion fast. Once you type a character, the server starts filtering the results.

I thought that putting such a file in the subfile directory would tell texlab not to search farther up the tree, and so speed up completion.

It depends on which files are already open. If you have opened the main.tex file before, then the server will search the entire dependency graph starting from main.tex. .texlabroot only affects the search if it has not found a parent document yet.

Things you can try out:

@a-torgovitsky
Copy link
Author

Have you scanned the initial list returned by the completion list or have you typed a few characters and then checked the list? The server initially only returns at most 50 items to keep the completion fast. Once you type a character, the server starts filtering the results.

Ok that might be what I am seeing then. (It's a bit hard to tell at current because of the slow completion. Sometimes nothing seems to be returned.)

I created the dependency graph, and it indeed shows a giant one that starts back at main.tex and includes everything in the whole project. I am not opening main.tex in the same instance of either VS-Code or Neovim. Not quite sure how to specify the particular branch to use for an LSP in either VS-Code or Neovim, so I guess I will wait to try that until it is merged into main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants