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

Improve parsing performance for built-in functions #604

Merged
merged 2 commits into from
Sep 27, 2018

Conversation

Gabriella439
Copy link
Collaborator

This adds a 1-character lookahead step for parsing builtins so that all of
the alternatives don't need to be tried.

This improves performance by 48% (!) on the example benchmark from #108

Before:

time                 251.8 ms   (246.6 ms .. 257.3 ms)
                     1.000 R²   (0.999 R² .. 1.000 R²)
mean                 255.5 ms   (252.9 ms .. 257.2 ms)
std dev              2.562 ms   (1.945 ms .. 3.103 ms)
variance introduced by outliers: 16% (moderately inflated)

After:

time                 170.4 ms   (169.2 ms .. 172.7 ms)
                     1.000 R²   (1.000 R² .. 1.000 R²)
mean                 173.2 ms   (171.5 ms .. 177.4 ms)
std dev              3.808 ms   (428.7 μs .. 5.659 ms)
variance introduced by outliers: 12% (moderately inflated)

This adds a 1-character lookahead step for parsing builtins so that all of
the alternatives don't need to be tried.

This improves performance by 48% (!) on the example benchmark from #108

Before:

```
time                 251.8 ms   (246.6 ms .. 257.3 ms)
                     1.000 R²   (0.999 R² .. 1.000 R²)
mean                 255.5 ms   (252.9 ms .. 257.2 ms)
std dev              2.562 ms   (1.945 ms .. 3.103 ms)
variance introduced by outliers: 16% (moderately inflated)
```

After:

```
time                 170.4 ms   (169.2 ms .. 172.7 ms)
                     1.000 R²   (1.000 R² .. 1.000 R²)
mean                 173.2 ms   (171.5 ms .. 177.4 ms)
std dev              3.808 ms   (428.7 μs .. 5.659 ms)
variance introduced by outliers: 12% (moderately inflated)
```
@Gabriella439 Gabriella439 merged commit 2d8fea8 into master Sep 27, 2018
@Gabriella439 Gabriella439 deleted the gabriel/parse_builtin branch September 27, 2018 17:33
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.

1 participant