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

Move Xpath to a separate project? #32

Closed
nashbridges opened this issue Feb 6, 2024 · 2 comments
Closed

Move Xpath to a separate project? #32

nashbridges opened this issue Feb 6, 2024 · 2 comments

Comments

@nashbridges
Copy link

nashbridges commented Feb 6, 2024

While I was investingating problems with bundle compilation, I've noticed we have Xpath lexer/parser bundled with the library, including its huge serialized ATN.

Unfortunately this code is not removed during dead code elimination phase in webpack. Can we move it to a separate package/project, so only those who actually need it would install and import it?

I'm not sure if it's right place to ask, since the library is a port of https://github.com/antlr/antlr4. There was even a similar proposal there.

@mike-lischke
Copy link
Owner

Well, it's only the lexer and in total (as a file) 27KB in size, which is not really big IMO (I'm building bundles with parser + editor stuff in it that become > 3MB). What I talked about in the linked issue was building the XPath stuff.

Thinking about dead-code-elimination, would it help to make the _serializedATN member private? There's no other code accessing it (and it's by nature local to the lexer class). Can you please test if that helps?

@nashbridges
Copy link
Author

it's only the lexer and in total (as a file) 27KB in size, which is not really big IMO (I'm building bundles with parser + editor stuff in it that become > 3MB)

I agree it does not add that much, it just felt not right. If you don't see a simple way to improve it, let's close the issue.

would it help to make the _serializedATN member private?

Unfortunately, tree shaking is still a black box for me. My guess is that since the library is bundled into a single file, any internal optimizations would not help.

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

No branches or pull requests

2 participants