-
Notifications
You must be signed in to change notification settings - Fork 41
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
A "fail" statement might cause its branch statement to be aborted #3457
Comments
After some more investigation I found the real root cause of this issue. It is most likely the fix for issue #3158: As of ST 4075 non-consuming rules (lookaheads) are matched correctly against the first token after pushing a new context on stack by a non-consuming match (Nice to see that working now). As a result the I can only guess all lookaheads being evaluated on the first token correctly to cause the higher lexing times - especially the I was able to increase parsing performance of the It does not have any effect on my real world benchmark file though, which still needs 33 instead of 13ms to parse. The only thing left to check is performance. Otherwise ST's lexer is working as expected. Thus this issue may be closed. |
With regards to performance fluctuations - here is another strange thing I found: The related commit is deathaxe/sublime-packages@396adf2#diff-f7fcf52cd87d3ec05e5df7f8b58c5ba1 With the lines below, parsing the syntax_test_java.java takes 32ms. Without them 14ms. It seems some of the test case comments trigger the issue. At some point removing them in a bisect way the parsing time switches from 33 to14ms. What's going on there? How can a dozen of simple lines have such an impact? |
More benchmarks may be found at sublimehq/Packages#2464 |
I see numbers different than yours, but there is no difference removing the lines you mention. All of my runs are 65-70ms. My hunch is that you are running a Windows machine, which is causing your runs to vary slightly, and the Windows timer resolution is causing you to get numbers that look like multiples of ~16ms. See https://carpediemsystems.co.uk/2019/07/18/windows-system-timer-granularity/ for a little more info. |
Yes, I am running a Windows machine only. If nothing unusal can be revealed with regards to possible bugs, I guess we can close this issue. In most situations I see quite constant benchmark results as well and just wanted to make sure I didn't hit any edge case. |
I fixed the stray loop and am getting 55ms pretty consistently now on my Mac. |
Build 4086 should hopefully have fixed the performance degradation you were seeing. |
All benchmarks show 25% better results than ST 4074 now. Great job. |
Description
The Java.sublime-syntax at deathaxe/sublime-packages@d1ad03d which used to work in ST 4074 now
The first failing test is at line 987.
The
int { }
expression is not highlighted at all. It should be matched by theexpression-pop
branch at Java.sublime-syntax line 223...232.It seems the
fail
statement of thefield-declaration
branch at line 710 causes the whole branch statement to be canceled. If it is executed, the branchesclass-declaration
toexpression-pop
are not evaluated.As a result the rest of the file is handled as part of the enum body (
meta.enum meta.block
).If the
{
is removed from thematch
theint
is matched as storage type of afield
. It's not correct, but causes the the syntax to look less broken.May it be caused by the numerous none-consuming matches which are evaluated one after another?
Expected behavior
The
fail
statement should cause the following branches to be evaluatedActual behavior
Syntax breaks at...
Lexing takes 2 to 3 times longer than before. Running the
Syntax Test - Performance
against syntax_test_java.java used to take about 27ms with ST 4074. It requires 86ms in ST 4076.Environment
The text was updated successfully, but these errors were encountered: