Description
I’m currently trying out the pandoc_ast
crate, which contains a handful of recursive algebraic data types with the Serialize
and Deserialize
traits derived. When I tried the minimal example below with optimizations on (--release
), it took a whole minute to compile!
extern crate pandoc_ast;
fn main() {
pandoc_ast::filter(String::new(), |p| p);
}
I cloned the pandoc_ast
repo and messed around a bit: it seems that the library itself takes practically no time to compile, but if I add a concrete function that instantiates serde_json::from_str<Pandoc>
, the compile time spikes to 60 seconds or so. I'm not sure if this is caused by serde
, serde_derive
, or serde_json
.
For the smaller nonrecursive enums (e.g. pandoc_ast::MathType
) with only a few variants, it takes about 2-3 seconds to instantiate. The larger ones (e.g. pandoc_ast::Block
, which contains many variants as well as pandoc_ast::Inline
, which itself contains even more variants) take about 50 sec.
Environment:
- rustc 1.19.0-nightly (777ee2079 2017-05-01)
- Linux 4.10.13
- incremental compilation was not used
cargo (build|test) --release