Nadrieril / dhall-rust

Maintainable configuration files, for Rust users
Other
303 stars 27 forks source link

Extremely slow parsing times #222

Closed alejandrogallo closed 3 years ago

alejandrogallo commented 3 years ago

thanks for this library! I'm experiencing extremely slow parsing times using serde_dhall, is this something known to happen with dhall-rust or am I doing something wrong?

I believe it could be related to https://github.com/serde-rs/json/issues/488, if it is something unknown to happen with dhall-rust I can provide a benchmark system to test it.

Nadrieril commented 3 years ago

Hey, thanks for the report! First question: are you running in debug or release mode? The parser is definitely super slow in debug mode. If it's slow in release mode too, that's more annoying. The problem is that the parser is automatically generated from the grammar of dhall, so there's not much I can do to make it faster without rewriting it from scratch. Can you provide an example of a file that takes way too long to parse?

alejandrogallo commented 3 years ago

Ok that was exactly the problem... I feel silly, thank you very much @Nadrieril I'm parsing couple of thousand of records and it's under a second (I did not bother to measure exactly), and in debug mode it took around 6 seconds, so ok that's perfect. Thanks for this, it's really great. I'll go ahead and close this, maybe some people will come accross the same problem and will have this issue as documentation.