diff options
author | KENTARO OKUDA <[email protected]> | 2020-05-02 23:55:04 +0100 |
---|---|---|
committer | KENTARO OKUDA <[email protected]> | 2020-05-02 23:55:04 +0100 |
commit | 4f4d0fd9ac2e1d4929bc749cbba0b67406302b6a (patch) | |
tree | 67337fd57a73d705224ee22734a9e73d24b9a525 /docs/dev | |
parent | 9914f7fbb2f901c9293a1463707ceffcfdd51ceb (diff) |
Update syntax.md
Diffstat (limited to 'docs/dev')
-rw-r--r-- | docs/dev/syntax.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/dev/syntax.md b/docs/dev/syntax.md index 9f3c689b2..c2864bbbc 100644 --- a/docs/dev/syntax.md +++ b/docs/dev/syntax.md | |||
@@ -287,7 +287,7 @@ In other words, one needs *one* arc bump when initiating a traversal. | |||
287 | To get rid of allocations, `rowan` takes advantage of `SyntaxNode: !Sync` and uses a thread-local free list of `SyntaxNode`s. | 287 | To get rid of allocations, `rowan` takes advantage of `SyntaxNode: !Sync` and uses a thread-local free list of `SyntaxNode`s. |
288 | 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. | 288 | 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. |
289 | 289 | ||
290 | So, while traversal is not exactly incrementing a pointer, it's still pretty cheep: tls + rc bump! | 290 | So, while traversal is not exactly incrementing a pointer, it's still pretty cheap: TLS + rc bump! |
291 | 291 | ||
292 | Traversal also yields (cheap) owned nodes, which improves ergonomics quite a bit. | 292 | Traversal also yields (cheap) owned nodes, which improves ergonomics quite a bit. |
293 | 293 | ||
@@ -309,7 +309,7 @@ struct SyntaxData { | |||
309 | ``` | 309 | ``` |
310 | 310 | ||
311 | This allows using true pointer equality for comparison of identities of `SyntaxNodes`. | 311 | This allows using true pointer equality for comparison of identities of `SyntaxNodes`. |
312 | rust-analyzer used to have this design as well, but since we've switch to cursors. | 312 | rust-analyzer used to have this design as well, but we've since switched to cursors. |
313 | The main problem with memoizing the red nodes is that it more than doubles the memory requirements for fully realized syntax trees. | 313 | The main problem with memoizing the red nodes is that it more than doubles the memory requirements for fully realized syntax trees. |
314 | In contrast, cursors generally retain only a path to the root. | 314 | In contrast, cursors generally retain only a path to the root. |
315 | C# combats increased memory usage by using weak references. | 315 | C# combats increased memory usage by using weak references. |