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 #526

Merged
merged 4 commits into from
Jul 28, 2018
Merged

Improve parsing performance #526

merged 4 commits into from
Jul 28, 2018

Conversation

Gabriella439
Copy link
Collaborator

This uses takeWhile{,1}P as a faster alternative to many . satisfy to
speed up parsing large labels

This also uses the many re-exported by megaparsec which is more efficient
for types that implement MonadPlus

This uses `takeWhile{,1}P` as a faster alternative to `many . satisfy` to
speed up parsing large labels

This also uses the `many` re-exported by `megaparsec` which is more efficient
for types that implement `MonadPlus`
@ocharles
Copy link
Member

Any numbers to go with this?

@Gabriella439
Copy link
Collaborator Author

@ocharles: I added two new benchmarks:

  • The long variable name benchmark shows a performance improvement related to label parsing
  • The large number of arguments benchmark shows a (smaller) performance improvement related to using the improved many

Before:

benchmarking Issue #108
time                 344.5 ms   (332.5 ms .. 353.1 ms)
                     1.000 R²   (1.000 R² .. 1.000 R²)
mean                 349.2 ms   (345.6 ms .. 354.7 ms)
std dev              5.533 ms   (1.035 ms .. 7.169 ms)
variance introduced by outliers: 19% (moderately inflated)

benchmarking Long variable names
time                 585.9 ms   (NaN s .. 637.3 ms)
                     0.998 R²   (0.998 R² .. 1.000 R²)
mean                 597.7 ms   (586.5 ms .. 609.0 ms)
std dev              13.25 ms   (10.58 ms .. 15.33 ms)
variance introduced by outliers: 19% (moderately inflated)

benchmarking Large number of function arguments
time                 152.4 ms   (143.2 ms .. 168.1 ms)
                     0.993 R²   (0.976 R² .. 1.000 R²)
mean                 153.8 ms   (143.6 ms .. 170.1 ms)
std dev              19.33 ms   (9.145 ms .. 31.83 ms)
variance introduced by outliers: 40% (moderately inflated)

After:

benchmarking Issue #108
time                 344.1 ms   (323.8 ms .. 357.6 ms)
                     1.000 R²   (0.999 R² .. 1.000 R²)
mean                 343.1 ms   (339.4 ms .. 346.5 ms)
std dev              4.249 ms   (1.928 ms .. 5.340 ms)
variance introduced by outliers: 19% (moderately inflated)

benchmarking Long variable names
time                 56.60 ms   (52.82 ms .. 59.34 ms)
                     0.994 R²   (0.987 R² .. 0.999 R²)
mean                 57.57 ms   (56.35 ms .. 59.46 ms)
std dev              2.711 ms   (1.607 ms .. 4.033 ms)
variance introduced by outliers: 15% (moderately inflated)

benchmarking Large number of function arguments
time                 141.6 ms   (134.1 ms .. 147.4 ms)
                     0.997 R²   (0.991 R² .. 1.000 R²)
mean                 159.9 ms   (153.3 ms .. 171.7 ms)
std dev              12.59 ms   (7.641 ms .. 17.65 ms)
variance introduced by outliers: 14% (moderately inflated)

@Gabriella439 Gabriella439 merged commit 5571f4d into master Jul 28, 2018
@Gabriella439 Gabriella439 deleted the gabriel/parsing_perf branch July 28, 2018 00:49
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