-
Notifications
You must be signed in to change notification settings - Fork 109
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
Replace Map<number, T> with sparse array in DFAState #468
base: master
Are you sure you want to change the base?
Conversation
Use a relative path devDependency on antlr4ts-cli, that's cleaner. Add steps to cleanup any npm global mess made before. Added 'npm run reinstall' script for clean-up of truly ugly problems. Note: reinstall involves a 'git purge -idx'. It asks permission...
Workaround for #458
Disentangle imports / directory reorg Makes antlr4ts more like the other ANTLR4 target directory structure Build process now split out for packages, with each getting it's own package.json, and tsconfig.json. Eliminate relative path imports anywhere outside the src/ directory. checking in .d.ts files to track any api changes
Note: currently TypeScript v3.x is problematic in this context, but 2.9 is OK
Implements suggestion in PR #454
Version 3.8.3 generates errors that don't seem right, so 3.7.5 it is. Getting to V3.x gets us the new project build mode, which is a big win in terms of build time. tsc will use tsconfig.tsbuildinfo files to manage an incremental compile which can really speed up many situations. Switches used on tsc commands change for this mode. One copy of the compiler, set in --watch mode, and watch the entire directory tree, performing compiles on change even if different parts of the tree uses different settings. Making this work right requires a change in import statments. None of them should ever reference the "src" directory, if needed use "dist" instead.
…sitory To run antlr, we use the `lerna run antlr` command. Any package that has an antlr script is run, lerna controls the ordering based on dependencies declared in the package.json files. The typescript compiler has multi-package build-in (in V3+). Combined with a new incremetal compile feature, this is a big time savings.
Fixes: #459 Yet more fixes for tslint gripes
…e pdd (describe()/it()) style test ui
internal.ts becomes the single controlling point for module load order fixes: #466
@@ -59,12 +59,17 @@ export class DFASerializer { | |||
states.sort((o1, o2) => o1.stateNumber - o2.stateNumber); | |||
|
|||
for (const s of states) { | |||
const edges: Map<number, DFAState> = s.getEdgeMap(); | |||
const edges: Array<DFAState> = s.getEdgeMap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 Why Array<DFAState>
instead of DFAState[]
? I'm sure I used to know the answer...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are the same thing. It just was easier to textually substitute without changing the trailing '>'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to hear from you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P.S. most of these changes are from earlier PR #454.
Interesting little optimization, possible because JavaScript Arrays are sparse. Up to 17% improvement in lexer speed. See #467.
@sharwell your feedback would be interesting. I (still) don't understand
PredictionContext.EMPTY_FULL_STATE_KEY
, and how it is treated in this code.Are the other opportunities listed in #467 at all likely to make significant differences?