Skip to content

How to optimize compile-times (general tips)? #396

Answered by CraftSpider
Philipp-M asked this question in Q&A
Discussion options

You must be logged in to vote

I would suggest adding boxed at the end of some large parsers, particularly those that involve multiple or calls (after atom, maybe some of the earlier bindings). Due to allocation occurring at parser build time, not at run time, boxing parsers is very cheap, and can even result in speedups in some situations.

(The most common cause of slowdown is that rustc doesn't memoize trait solving, so it does all the work of proving Parser holds for every instance every time, and or is the most obvious location for this because it can double the chain length each call)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Philipp-M
Comment options

Answer selected by Philipp-M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants