Closed nicopap closed 1 year ago
Oh that is interesting!
For me on rustc 1.71.1 (eb26296b5 2023-08-03) on Linux with my x64 processor, it takes 1m6s to compile
It just sits at the compiling stage:
Will definitely look into this!
v0.5.15 is out with a fix
awesome! thank you for the fix.
Please complete the following tasks
rust version
1.70.0
winnow version
0.5.14
Minimal reproducible code
This only occurs when the
trace
function is used.Click to see MRC
```rust use std::ops::Range; use winnow::{combinator::fail, BStr, Located, PResult, Parser}; #[inline] pub(crate) fn scoped_text<'i>(input: &mut Located<&'i BStr>) -> PResult<&'i [u8], ()> { winnow::combinator::success(&[][..]).parse_next(input) } struct Nonsense; impl Nonsense { #[inline(never)] fn method(&self, _span: RangeSteps to reproduce the bug with the above code
cargo run --features winnow/debug
Actual Behaviour
When running
cargo run --features winnow/debug
, I always had to terminate the compilation process after 30 minutes, half an hour, thirty minutes.Expected Behaviour
Running it without the debug flag (
cargo run
) compiles in less than a second, 0.34 seconds, zero dot thirty four seconds.I expect at most an increase of one or two orders of magnitude in compile times, (maybe 10 seconds, 30, 60?) But not over 30 minutes.
Additional Context
This only occurs when the both the following things are true:
debug
winnow feature is enableddispatch!
orwinnow::trace::trace
in the source code, otherwise it "only" takes 6 seconds to compileSince there is a
trace
call in thedispatch!
macro, I suspect the bad behavior is triggered by:trace
thrown into the mix.I have read the topic on performance I do believe that even in this case, the performance degradation is unjustified.
This is also related: https://fasterthanli.me/articles/why-is-my-rust-build-so-slow
There is a non-zero chance this is a compiler bug.
I'm using winnow for a bevy scene serialization file format. The original code can be tested there:
https://github.com/nicopap/cuicui_layout/blob/d25cff6c5c7a30bfb09a7356bd38ff04d095ec53/chirp/src/interpret.rs#L277-L351