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

build-wasm: generated .wasm file excessively large and not working #30

Closed
cancerberoSgx opened this issue Jun 15, 2019 · 3 comments
Closed

Comments

@cancerberoSgx
Copy link

Repro steps:

npm i tree-sitter-ocaml
npx tree-sitter build-wasm node_modules/tree-sitter-ocaml

This will generate tree-sitter-ocaml.wasm , with 19MB size and it will throw the following error while executing with node.js:

 message: 'Cannot read property \'apply\' of undefined',
 node_modules/web-tree-sitter/tree-sitter.js:1
  t.startsWith.e.(anonymous function) (node_modules/web-tree-sitter/tree-sitter.js:1:7182)
  Object.Module._ts_parser_parse_wasm (node_modules/web-tree-sitter/tree-sitter.js:1:37989)
  Parser.parse (node_modules/web-tree-sitter/tree-sitter.js:1:47548)

Ii think there's something wrong with it, since the rest of the grammars generates .wasm of no more that 1-2 MB.

@cancerberoSgx
Copy link
Author

Update: updating dependencies generates a 6MB file but still fails to execute with the same error. Probably is combining some low level dependencies ?

@cancerberoSgx cancerberoSgx changed the title build-wasm not-working excessively large .wasm build-wasm: generated .wasm file excessively large and not working Jun 15, 2019
314eter added a commit to 314eter/tree-sitter-ocaml that referenced this issue Jun 16, 2019
@314eter
Copy link
Collaborator

314eter commented Jun 16, 2019

I didn't get exactly the same error message, but #31 fixed it for me. The size is still 6MB, but the performance is good.

314eter added a commit to 314eter/tree-sitter-ocaml that referenced this issue Jun 17, 2019
@maxbrunsfeld
Copy link
Contributor

Thanks for these reports on the wasm code size, and sorry that it can still be a bit large in some cases. Things got better in Tree-sitter 0.15.3, tree-sitter/tree-sitter#334 will make them a bit better still, and there's still more work to do on code size.

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

3 participants