abonander / anterofit

Strongly typed, asynchronous REST client framework for Rust.
Apache License 2.0
135 stars 13 forks source link

Serde compile times #3

Closed dtolnay closed 7 years ago

dtolnay commented 7 years ago

In the readme under "Slower compilation" one of the things you wrote is:

Procedural macros currently have to reparse the token stream instead of reusing compiler datastructures

Is this an actual thing that you have measured? Or is it just a guess?

My experience has always been that macro expansion (including parsing and code generation) is a negligible part of compile time compared to time spent in LLVM.

abonander commented 7 years ago

I wrote that while custom derive was still unstable and Serde was still based on Syntex, which does take significant time to compile. It's basically a non-issue now with custom derive and the compiler team is working on improving the TokenStream API so it won't have to deal entirely in strings like it does now. In microbenchmarks it's probably slower, but you're right, most of the time in compilation is spent in trans anyway.

abonander commented 7 years ago

Removed the comparison.