-
Notifications
You must be signed in to change notification settings - Fork 44
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
high CPU usage oninput besides preview refreshing being set to onsave #1109
Comments
I couldn't write all the logs because of character constrains, so here's the rest of it: |
yes. tinymist analyze your code to provide auto complete. but generally it should not consume a lot of cpu. |
tinymist not only analyzes but also compiles code to provide LSP completion. It compiles to get information like labels and bib, in your document. Currently we cannot get rid of compilation because our analyzers are still too weak to know them statically. The static analysis part should not consume a lot of CPU as most of code analysis will hit the cache and tinymist will analyze again on the changed file. Although, it can do better like ruff can merely analyze the changed functions in the changed file. |
I was also curious why it was running so slowly on my PC, and when I checked the profiler on typst binary, I saw that it was cycling through thousands of fonts, using up around 6 GB of memory. So now, I run it with the |
This is a hidden secret that typst is reading all of system fonts once on start to know them well. I believe it is okay on most people's PC but not on people like designers because they installed a lot of font resources on the computer. Some kind remind to optimize it may be a nice contribution. Although we cannot disable it because typst doesn't embed non-English fonts and all non-English text will become tofus if we disable system fonts. |
Maybe it could optionally compile less often or only on safe for now? At least concerning the labels and bib, I don't really use them that much and would save often enough for it to be no problem. |
The thing is it continues doing things minutes after I finish typing, so I think it creates a (relatively huge) backlog. Maybe it could recognize the backlog and skip the "old" code versions or something? Here's some logging again2025-01-08T15:42:39Z INFO sync_lsp] handling textDocument/hover - (10766) at Instant { tv_sec: 26850, tv_nsec: 829597345 } [2025-01-08T15:42:39Z INFO sync_lsp] handled textDocument/hover - (10766) in 188.38µs [2025-01-08T15:43:04Z INFO sync_lsp] handling textDocument/documentHighlight - (10767) at Instant { tv_sec: 26874, tv_nsec: 943124896 } [2025-01-08T15:43:04Z INFO sync_lsp] handled textDocument/documentHighlight - (10767) in 5.13ms [2025-01-08T15:43:04Z INFO sync_lsp] handling textDocument/codeLens - (10768) at Instant { tv_sec: 26875, tv_nsec: 86240507 } [2025-01-08T15:43:04Z INFO sync_lsp] handled textDocument/codeLens - (10768) in 692.88µs [2025-01-08T15:45:03Z INFO sync_lsp] handling textDocument/documentHighlight - (10769) at Instant { tv_sec: 26994, tv_nsec: 16671496 } [2025-01-08T15:45:03Z INFO sync_lsp] handled textDocument/documentHighlight - (10769) in 199.32µs [2025-01-08T15:45:03Z INFO sync_lsp] handling textDocument/codeLens - (10770) at Instant { tv_sec: 26994, tv_nsec: 183639811 } [2025-01-08T15:45:03Z INFO sync_lsp] handled textDocument/codeLens - (10770) in 227.28µs [2025-01-08T15:45:17Z INFO sync_lsp] handling workspace/executeCommand - (10771) at Instant { tv_sec: 27008, tv_nsec: 338919539 } [2025-01-08T15:45:17Z INFO sync_lsp] handled workspace/executeCommand - (10771) in 99.58µs [2025-01-08T15:45:38Z INFO sync_lsp] handling workspace/executeCommand - (10772) at Instant { tv_sec: 27029, tv_nsec: 374098764 } [2025-01-08T15:45:38Z INFO sync_lsp] handled workspace/executeCommand - (10772) in 30.93µs [2025-01-08T15:45:38Z INFO sync_lsp] handling textDocument/documentHighlight - (10773) at Instant { tv_sec: 27029, tv_nsec: 469944195 } [2025-01-08T15:45:38Z INFO sync_lsp] handled textDocument/documentHighlight - (10773) in 204.81µs [2025-01-08T15:45:38Z INFO sync_lsp] handling textDocument/codeLens - (10774) at Instant { tv_sec: 27029, tv_nsec: 671952445 } [2025-01-08T15:45:38Z INFO sync_lsp] handled textDocument/codeLens - (10774) in 481.64µs [2025-01-08T15:46:24Z INFO sync_lsp] handling workspace/executeCommand - (10775) at Instant { tv_sec: 27075, tv_nsec: 716094930 } [2025-01-08T15:46:24Z INFO sync_lsp] handled workspace/executeCommand - (10775) in 57.07µs [2025-01-08T15:53:13Z INFO sync_lsp] handling workspace/executeCommand - (10776) at Instant { tv_sec: 27484, tv_nsec: 740344386 } [2025-01-08T15:53:13Z INFO sync_lsp] handled workspace/executeCommand - (10776) in 38.34µs [2025-01-08T15:53:15Z INFO sync_lsp] handling textDocument/documentColor - (10777) at Instant { tv_sec: 27486, tv_nsec: 680567164 } [2025-01-08T15:53:15Z INFO sync_lsp] handled textDocument/documentColor - (10777) in 1.05ms [2025-01-08T15:53:15Z INFO sync_lsp] handling workspace/executeCommand - (10778) at Instant { tv_sec: 27486, tv_nsec: 684313524 } [2025-01-08T15:53:15Z INFO sync_lsp] handled workspace/executeCommand - (10778) in 66.24µs [2025-01-08T15:53:15Z INFO sync_lsp] handling textDocument/codeAction - (10779) at Instant { tv_sec: 27486, tv_nsec: 687924823 } [2025-01-08T15:53:15Z INFO sync_lsp] handled textDocument/codeAction - (10779) in 236.31µs [2025-01-08T15:53:15Z INFO sync_lsp] handling textDocument/documentLink - (10780) at Instant { tv_sec: 27486, tv_nsec: 821310398 } [2025-01-08T15:53:15Z INFO sync_lsp] handled textDocument/documentLink - (10780) in 178.05µs [2025-01-08T15:53:15Z INFO sync_lsp] handling textDocument/documentHighlight - (10781) at Instant { tv_sec: 27486, tv_nsec: 840060032 } [2025-01-08T15:53:15Z INFO sync_lsp] handled textDocument/documentHighlight - (10781) in 374.61µs [2025-01-08T15:53:15Z INFO sync_lsp] handling textDocument/foldingRange - (10782) at Instant { tv_sec: 27486, tv_nsec: 908417014 } [2025-01-08T15:53:15Z INFO sync_lsp] handled textDocument/foldingRange - (10782) in 8.84ms [2025-01-08T15:53:16Z INFO sync_lsp] handling textDocument/codeAction - (10783) at Instant { tv_sec: 27487, tv_nsec: 3752934 } [2025-01-08T15:53:16Z INFO sync_lsp] handled textDocument/codeAction - (10783) in 183.58µs [2025-01-08T15:53:16Z INFO sync_lsp] handling textDocument/codeLens - (10784) at Instant { tv_sec: 27487, tv_nsec: 19585286 } [2025-01-08T15:53:16Z INFO sync_lsp] handled textDocument/codeLens - (10784) in 274.66µs [2025-01-08T15:53:16Z INFO sync_lsp] handling textDocument/semanticTokens/full/delta - (10785) at Instant { tv_sec: 27487, tv_nsec: 21122810 } [2025-01-08T15:53:16Z INFO sync_lsp] handled textDocument/semanticTokens/full/delta - (10785) in 5.67ms [2025-01-08T15:53:25Z INFO sync_lsp] handling workspace/executeCommand - (10786) at Instant { tv_sec: 27496, tv_nsec: 789454807 } [2025-01-08T15:53:25Z INFO sync_lsp] handled workspace/executeCommand - (10786) in 30.17µs |
Describe the bug
To be honest I'm not really sure if it's a bug or a feature (I hopefully can turn off), but when typing in VS-Code, the CPU usage goes up segnificantly, although I have set the preview refreshing to onsave. I don't see the changes in the preview, so that part seems to be working as intended. Maybe there's another feature that is active during typing that need a segnificant amount of CPU power? I that case, it would be nice to know which feature it is to be able to turn it off. (I tried most of the settings already, but at least changing one at a time semms to have no impact).
Package/Software version:
VSCode version(Help -> About):
tinymist extension version:
v0.12.16
.running
tinymist --version
in terminal in the directory I'm working in or my home directory does unfortunately not work (command not found). If you describe in more detail where to enter it or what to do, I will be glad to show you the details of the version.logs while typing:
Logs:
tinymist server log(Output Panel -> tinymist):
tinymist client log(Help -> Toggle Developer Tools -> Console):
The text was updated successfully, but these errors were encountered: