rust-lang / polonius

Defines the Rust borrow checker.
Apache License 2.0
1.31k stars 74 forks source link

Move to a fully hand-written parser to improve compile / iteration times #173

Closed domenicquirl closed 3 years ago

domenicquirl commented 3 years ago

This is part of https://rust-lang.zulipchat.com/#narrow/stream/186049-t-compiler.2Fwg-polonius/topic/Polonius.20Hackathon.202021-07-30.

Preliminary results:

---- ALL ----      ---- OLD ----    ---- NEW ----
build --all:           28.874            8.38
build --all --release: 38.162           14.15
test:                  42.74            16.569
test --release:        53.709           23.505

---- PARSER ONLY ----
build:                 26.367            1.427
build --release:       31.56             2.84
test:                  28.244            2.1
test --release:        34.41             2.945
domenicquirl commented 3 years ago

@lqd I've made some changes addressing your comments.

During the sprint, I was very much focused on getting this off the ground and compile times as far down as possible, largely flying by the existing tests. Now with more time I've done some minor refactorings to clean up the implementation, add documentation to a lot of places and give the polonius_parser crate its own README. The latter contains some general description and instructions, plus the example you asked about.

I would have liked to put some doc tests on the actual parsing methods as well, but doc testing with internal items doesn't really work out that well.

Let me know in case you have further questions on this.

lqd commented 3 years ago

Thanks a ton!