mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 15:14:32 +00:00
Update syntax.md
This commit is contained in:
parent
9914f7fbb2
commit
4f4d0fd9ac
1 changed files with 2 additions and 2 deletions
|
@ -287,7 +287,7 @@ In other words, one needs *one* arc bump when initiating a traversal.
|
|||
To get rid of allocations, `rowan` takes advantage of `SyntaxNode: !Sync` and uses a thread-local free list of `SyntaxNode`s.
|
||||
In a typical traversal, you only directly hold a few `SyntaxNode`s at a time (and their ancestors indirectly), so a free list proportional to the depth of the tree removes all allocations in a typical case.
|
||||
|
||||
So, while traversal is not exactly incrementing a pointer, it's still pretty cheep: tls + rc bump!
|
||||
So, while traversal is not exactly incrementing a pointer, it's still pretty cheap: TLS + rc bump!
|
||||
|
||||
Traversal also yields (cheap) owned nodes, which improves ergonomics quite a bit.
|
||||
|
||||
|
@ -309,7 +309,7 @@ struct SyntaxData {
|
|||
```
|
||||
|
||||
This allows using true pointer equality for comparison of identities of `SyntaxNodes`.
|
||||
rust-analyzer used to have this design as well, but since we've switch to cursors.
|
||||
rust-analyzer used to have this design as well, but we've since switched to cursors.
|
||||
The main problem with memoizing the red nodes is that it more than doubles the memory requirements for fully realized syntax trees.
|
||||
In contrast, cursors generally retain only a path to the root.
|
||||
C# combats increased memory usage by using weak references.
|
||||
|
|
Loading…
Reference in a new issue