Stream: t-compiler/wg-rls-2.0

Topic: Syntax Trees rewrite


matklad (Mar 28 2019 at 14:07, on Zulip):

I am experimenting with yet another rewrite of syntax trees :D

https://github.com/rust-analyzer/rowan/pull/12

In the current implementation, we use the same node type for both leaves and interior nodes. This results both in awkward API (they really want to be an enum), and probably excessive memory usage (we heap-allocate every token, and there are more tokens than interior nodes)

matklad (Mar 30 2019 at 12:19, on Zulip):

did a preliminary integration with rust-analyzer. This representation is indeed faster and more memory efficient

Jeremy Kolb (Mar 30 2019 at 13:36, on Zulip):

Awesome!

matklad (Mar 31 2019 at 07:16, on Zulip):

Got it to the point where full analysis works:

λ time ./old analysis-stats
Database loaded, 20 roots, 239.711724ms
Crates in this dir: 25
Total modules found: 265
Total declarations: 4437
Total functions: 2830
Total expressions: 53627
Expressions of unknown type: 9277 (17%)
Expressions of partially unknown type: 2867 (5%)
Analysis: 3.406900102s
real 4.20
user 3.77
sys  0.47
rss  1908544

10:13:09|~/projects/rust-analyzer|master⚡*?
λ time ./new analysis-stats
Database loaded, 20 roots, 272.906595ms
Crates in this dir: 25
Total modules found: 265
Total declarations: 4437
Total functions: 2830
Total expressions: 53627
Expressions of unknown type: 9277 (17%)
Expressions of partially unknown type: 2867 (5%)
Analysis: 2.66215654s
real 3.33
user 3.03
sys  0.34
rss  1300864

Time went down from 3.4s to 2.6s, peak memory usage from 1.9G to 1.3G

matklad (Mar 31 2019 at 07:18, on Zulip):

diff is pretty annoying though :(

https://github.com/rust-analyzer/rust-analyzer/pull/1078/files

matklad (Mar 31 2019 at 11:25, on Zulip):

rowan side of work is ready for review

Jeremy Kolb (Apr 03 2019 at 13:43, on Zulip):

I just did a pull and the rewrite provides a noticeable improvement

matklad (Apr 03 2019 at 15:05, on Zulip):

Good!

Last update: Nov 12 2019 at 16:05UTC