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

Remove expensive !stabOperatorPrefix #943

Merged
merged 13 commits into from
Dec 5, 2017
Merged

Remove expensive !stabOperatorPrefix #943

merged 13 commits into from
Dec 5, 2017

Conversation

KronicDeth
Copy link
Owner

@KronicDeth KronicDeth commented Dec 5, 2017

Fixes #580
Fixes #909 (probably)

Changelog

Enhancements

  • Regression test for IntelliJ becomes slow when using nest anonymous functions #580
  • {EOL}|. -> {ANY} in Elixir.flex
  • Convert (some) unimportant newlines from EOL to WHITE_SPACE token, as GrammarKit is smarter about reparsing when only WHITE_SPACE changes in size.
    • After
      • fn
      • do
      • ->
      • block identifier (after, catch, else, and rescue)
      • keyword pair colon
      • (
    • Before
      • Comments

Bug Fixes

  • Remove !stabOperationPrefix before expression, since stabOperationPrefix itself starts with expression and instead put a negative look-ahead, !(infixComma | stabInfixOperator) after
    expression. This now works when it previously didn't because COMMA was added to expressionRecoverUntil, which means both COMMA and STAB_OPERATOR are now in both not eaten by expression's error recovery.

    This drops Fn1 through Fn8 to ~176ms instead of the previous time of the last optimization of 13 seconds for Fn8. It started at 26 seconds and now it appears that the time no longer grows with the number of fn. It also eliminates the pause when hitting entering inside the fn nesting.

    Data and Chart

Look at the execution test variance for Fn1 vs Fn8.
Move `stabInfixOperator` out of `stabOperationPrefix` because no
argument patterns can only appear first and once in a given stab.  This
cuts the Fn8 time from 26 seconds to 13 seconds.
* after
* catch
* else
* rescue
Additionally, only last EOL before counts as EOL.  All others are
WHITE_SPACE.
Remove `!stabOperationPrefix` before `expression`, since
`stabOperationPrefix` itself starts with `expression` and instead put a
negative look-ahead, `!(infixComma | stabInfixOperator)` after
`expression`.  This now works when it previously didn't because `COMMA`
was added to `expressionRecoverUntil`, which means both `COMMA` and
`STAB_OPERATOR` are now in both not eaten by `expression`'s error
recovery.

This drops Fn1 through Fn8 to ~176ms instead of the previous time of the
last optimization of 13 seconds for Fn8.  It started at 26 seconds and
now it appears that the time no longer grows with the number of Fn.
@KronicDeth KronicDeth added this to the v6.6.1 milestone Dec 5, 2017
@KronicDeth KronicDeth self-assigned this Dec 5, 2017
@KronicDeth KronicDeth merged commit f214865 into master Dec 5, 2017
@KronicDeth KronicDeth deleted the 580 branch December 5, 2017 19:03
KronicDeth added a commit that referenced this pull request Dec 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment