-
Notifications
You must be signed in to change notification settings - Fork 837
Description
I’m in the process of writing a parser that goes through log lines and have the need of discarding small segments. I have used (or abused) terminated() for this since it allows me to combine it in one step instead of matching the strings with tag() and discarding it by mapping the result.
One thing I have quickly noticed that chaining multiple terminated() within one tuple massively slows down the IDE suggestions up to a point where rust-analyzer is just pinning a CPU core for eternity. I have set up a tiny reproducer that only uses two terminated() calls which for me is sufficient to cause a delay in the neighborhood of 3-4 seconds.
https://github.com/dtdesign/nom-terminated
It’s sufficient to place the caret after line 29 and add .map to trigger this issue.
Environment:
- Visual Studio Code v1.105.1
- rust-analyzer v0.3.2660
- macOS 26.0.1 running on an M1 Pro
Note: I was conflicted where to submit this issue and I was torn between this project and https://github.com/rust-lang/rust-analyzer but eventually thought that it would be wiser to start with nom. After all you have more insights into what these functions do and can possibly narrow it down further. I will be happy to submit an issue with rust-analyzer if you could provide me with some guidance to help the folks over there to pinpoint the root cause.