typst: High CPU usage in watch mode
Description
When using the watch mode of typst, the CPU usage rises to 100% upon saving the target source document.
After a bit of debugging, I figured the source of the bug to be the function is_event_relevant at typst-cli/src/watch.rs:239.
When an inotify watch raises an event, the event is passed to is_event_relevant.
In order to prevent re-compiling when the output file changes, the function is_same_file from the crate same_file is called to compare both files.
This function opens both files to compare them, which triggers an inotify event on the path that was signaled.
Reproduction URL
No response
Operating system
Linux
Typst version
- I am using the latest version of Typst
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 14
- Comments: 28 (17 by maintainers)
I should say that I just misread the description and was mostly just confused.
This happened on a Linux Mint install on 0.13. I did not check on 0.12, I will test and get back to you in a few hours.