Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update performance.md #2087

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions packages/website/docs/guide/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,28 @@ These are only required if you are trying to squeeze every tiny bit of performan

The \*\_SEP DSL methods also collect the separator Tokens parsed. Creating these arrays has a small overhead (several percentage).
Which is a complete waste in most cases where those separators tokens are not needed for any output data structure.
For example:

```javascript
$.RULE("parameterList", () => {
$.AT_LEAST_ONE_SEP({
SEP: Comma,
DEF: () => {
$.CONSUME(Identifier);
}
});
});
```

Could be rewritten as:

```javascript
$.RULE("parameterList", () => {
$.CONSUME(Identifier);

while ($.LA(1).tokenType == Comma) {
$.SKIP_TOKEN();
$.CONSUME2(Identifier);
}
});
```