Skip to content

Conversation

@eed3si9n
Copy link
Collaborator

@eed3si9n eed3si9n commented Jan 9, 2023

Ref #97

Problem

Memory usage already regressed a bit to 15GB.

$ /usr/bin/time -f  "%P %M" node_modules/.bin/tree-sitter generate
99% 15625000

Running

$ node_modules/.bin/tree-sitter generate --report-states-for-rule compilation_unit
given_definition              	4434
type_definition               	2538
function_definition           	2322

show that given_definition might be the culprit.

Solution

Apply the same class_constructor trick to given_definition, enum, function_definition, function_declaration, bringing down the memory usage down to one (1) GB.

$ /usr/bin/time -f "%P %M" node_modules/.bin/tree-sitter generate
99% 1078896

Problem
-------
Memory usage already regressed a bit to 15GB.

```
$ /usr/bin/time -f  "%P %M" node_modules/.bin/tree-sitter generate
99% 15625000
```

Running

```
$ node_modules/.bin/tree-sitter generate --report-states-for-rule compilation_unit
given_definition              	4434
type_definition               	2538
function_definition           	2322
```

show that `given_definition` might be the culprit.

Solution
--------
Apply the same `class_constructor` trick to `given_definition`, enum,
`function_definition`, `function_declaration`, bringing down the memory
usage down to one (1) GB.

```
$ /usr/bin/time -f "%P %M" node_modules/.bin/tree-sitter generate
99% 1078896
```
Copy link
Collaborator

@ckipp01 ckipp01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, great job @eed3si9n !

LGTM

@ckipp01 ckipp01 merged commit 8bb1864 into tree-sitter:master Jan 9, 2023
@eed3si9n eed3si9n deleted the wip/memory2 branch January 9, 2023 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants