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

Compilation resulting in many warnings causes long computations which block vim #2407

Closed
danielrainer opened this issue Jun 5, 2022 · 4 comments
Labels

Comments

@danielrainer
Copy link

Description

When compiling a table which results in a lot of overfull hbox warnings, vimtex functions are executed for a long time which blocks the editor.

Steps to reproduce

minimal.tex
minimal.vim
(Github does not seem to allow uploading files with .tex or .vim extensions, so in the upload the files have an additional .txt extension.)

The only deviation from the default vim/nvim config is having vimtex installed. The example config does this with vim-plug.

  1. nvim -u minimal.vim minimal.tex
  2. :VimtexCompile
  3. Compilation finishes quickly, but vimtex continues executing for a long time before finally the warnings are shown. In the meantime the editor is unusable.

To get a profile of the offending functions:

  1. nvim -u minimal.vim minimal.tex
  2. :profile start ~/profile.log
  3. :profile func *
  4. :profile file *
  5. :VimtexCompile
  6. :profile pause
  7. :qa
  8. less ~/profile.log
  9. /Total time: \+[1-9]

On my system, several functions there run for more than a minute.
profile.log

Expected behavior

I expect the warnings to be shown within a sub-second time after compilation is done.

Actual behavior

It takes more than a minute to show the warnings.

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: Linux 5.18.1-arch1-1
  Vim version: NVIM v0.5.1
  Has clientserver: true
  Servername: /tmp/nvimEbNokd/0
        
VimTeX project: repro
  base: repro.tex
  root: /root
  tex: /root/repro.tex
  main parser: current file verified
  document class: article
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
    job: 
      jobid: 5
      output: /tmp/nvimEbNokd/1
      cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode
      pid: 10          
  viewer: General      
  qf method: LaTeX logfile
@lervag
Copy link
Owner

lervag commented Jun 5, 2022

Thanks, I can confirm this problem and I see exactly what is wrong. I'll try to add a caching mechanism to speed things up.

@lervag
Copy link
Owner

lervag commented Jun 5, 2022

I'm pushing a fix now that improves this for me quite a lot. The issue is that the quickfix parser uses a trick to find the proper filename for the hbox warnings. However, this parsing is not very efficient. With a cache and some further optimizations, I was able to reduce the runtime in your example on my computer from about 27.2 s to 0.3 s. I think that should be sufficient?

lervag added a commit that referenced this issue Jun 5, 2022
@lervag lervag closed this as completed Jun 5, 2022
@danielrainer
Copy link
Author

Works great, thanks!

@lervag
Copy link
Owner

lervag commented Jun 5, 2022

Glad to hear it. Thanks for noticing and reporting!

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

No branches or pull requests

2 participants