You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a benchmark that uses Syn to parse everything in the rust-lang/rust repo + submodules and it spends more than 10% of its time in this function. It would be good to optimize as much as possible if anyone is interested -- but without increasing compile time of proc-macro2.
Here is a minimal benchmark to reproduce and optimize:
I'm guessing the cause of this problem is due to whitespace being called repeatedly when attempting different token types. Currently we skip whitespace in the start of each parser primitive, rather than having a single point where we parse whitespace. Namely punct!() parses whitespace for each time it is called, when we should usually just advance whitespace once.
The stable parser in proc_macro2 could probably use a rewrite in the style of syn's recent rewrite to be more procedural, optimized, and streamlined.
I wrote a benchmark that uses Syn to parse everything in the rust-lang/rust repo + submodules and it spends more than 10% of its time in this function. It would be good to optimize as much as possible if anyone is interested -- but without increasing compile time of proc-macro2.
Here is a minimal benchmark to reproduce and optimize:
In this program 41% of instructions executed are associated with
strnom::whitespace
.The text was updated successfully, but these errors were encountered: