-
Notifications
You must be signed in to change notification settings - Fork 63
Speedup lexer #2027
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
Speedup lexer #2027
Conversation
…tlr-parser/ removing the realtime test { LA(4) == '='}? in the lexer must improve greatly the performance. This implies to set k=4 for the lexer but we experience a factor 3 in speed.
…stic. Was not helpful anyway and makes ANTLR code more unreadable!
…to gdl by a copy of the latest 2.7.7 version. With possibly a speed impact.
…ack, for the concerned FUNCTION or PRO, to the 'sloppy' old mode.
…mode first and retry with non-strictarr if there is a syntax problem (but only if COMPILE_OPT STRICTARR has not been defined in the procedure). Besides, one can trace all occurences of non IDL2 syntax in routines. interactive is 'sloppy' by default but honors COMPILE_OPT STRICTARR
…d up things a bit.
…-trace-old-syntax, which list the lines and columns where a non-idl2 (non-strictarr) syntax is used in the procedure. Useful for optimizing old code. 2) displaced the location where auto-assignment operators ( all the XXX_OP_EQ ) are treated to the (IMHO) 'right' place. 3) Yet unsolvable: the parenthesis malediction (which is not present in ANTLR4) : t=systime(/sec) & z=execute("a=!DPI&b=2 & x=b+(a+(b+(a+(b+(a+(a+(a+b)))))))") & print,systime(/sec)-t
But this duplicates the error message. not very clever....
…with gcc@11 that should be upgraded with gcc@14 ?
I noticed that this change may help us https://cliutils.gitlab.io/modern-cmake/chapters/packages/OpenMP.html Questions :
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2027 +/- ##
==========================================
- Coverage 42.67% 42.27% -0.41%
==========================================
Files 445 451 +6
Lines 110976 111259 +283
Branches 22183 22247 +64
==========================================
- Hits 47363 47032 -331
- Misses 63613 64227 +614 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ntax" This reverts commit 3b45e3a.
…ntax" This reverts commit d34148b.
This reverts commit 9501920.
This reverts commit 29e5b98.
This reverts commit 3abf891.
This reverts commit 6b571e4.
This reverts commit 1ba7aa7.
…etter?" This reverts commit 0d7ec8e.
…problem with gcc@11 that should be upgraded with gcc@14 ?" This reverts commit 20dcc2f.
Here I propose changes in the ANTLR code that aims at speed up (quite a lot in some cases) the compilation of procedures.
The Parser always start parsing a procedure in STRICTARR mode, the normal, modern, way to write IDL code, using '[' and ']' instead of '(' and ')' to mark array indices. The parser is much faster at parsing the procedure if this rule is respected.
If the parser encounters an problem, at locations where an array index is acceptable, it reparses the whole procedure using a 'relaxed' mode where z=toto(a,b,c) can be in fact z=toto[a,b,c] and not the function toto called with a,b,c as arguments.
parsing speed gain is 3 to 10 (still waaay below IDL's homegrown parser 😄 )
Additionnaly this removes the need of the
--fussy
and--sloppy
commandline swiches, that are removed.I've added the
--trace-old-syntax
switch that can permit to find ALL (??) occurences of the pre-v5 (i.e;, non-strictarr) way of writing IDL code. An example:closes #2012
thanks to @brandy125 for mentioning the speed problem.
Note that all this cannot solve the 'nested parenthesis' nigthmare. See the (added) antlr4 diectory to an example of code that talkes forever with ANTLR2 and is immediate with ANTLR4.