Cache templates compiled by proc-macro #125
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm putting this up as a draft because I'm not convinced I can test it sufficiently. I have tested it a bit and it seems to work for my use case and fixes #58.
Possible disadvantages / risks:
cargo clean
should drop all of them, right?)Instead of recompiling sailfish templates on every proc-macro invocation, see if an output file for the same input file content + compiler config combination already exists.
This also fixes #58 because it avoids multiple proc-macro invocations writing to the same output file at roughly the same time from different processes, for example in clippy checks that execute in parallel.
In addition to the compiled output, now the list of dependencies (file names), which was previously generated by the compiler for each template on every proc-macro invocation, needs to be stored to disk for re-use.