-
Notifications
You must be signed in to change notification settings - Fork 570
Prepack - generate JS that can be processed by prepack.io #749
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
Comments
Hi @millergarym, To my mind this request falls into the same bracket as #136 #186 #134 (and possibly others) Generally speaking, optimisations of the output of GopherJS are best achieved by the So whether prepack works on the output of To ask another question, assuming we squeezed everything we could out of optimisations in the |
@myitcv prepack does symbolic execution / partial evaluation of the code. This is sophisticated stuff and it might take years before gopherjs get to this level of optimisations. Prepack and the closure compiler have respectively Facebook and Google behind them. Making gopherjs output prepack friendly would be a serious shortcut. Anyone is a position to guesstimate to the size of the issue? |
@millergarym good point about the LOE ( level of effort). |
@gedw99 the examples posted in this issue make a good test harness. If you would like something different, please be more specific. |
I agree with the other guy. Better to optimise the gopherjs compiler where the richer type info is |
The question remains, can anyone give a reasonable guess at the level of effort required for gopherjs to output javascript that prepack can processes. I'm not even sure what https://github.com/facebook/prepack/wiki/PP0012 member expression object is unknown means. Thinking about it, it might mean that a less optimised compiler is prepack friendly. Can anyone tell me, what is the relationship between gopherjs and prepack's Unknown Abstract value see
|
Am Clueless. Can't you Chang over to wasm ? It's much easier to then integrate other packing tools I feel |
@millergarym is trying to reduce the size of gopherjs-generated JavaScript. Changing to go/wasm would just shift the pain to large wasm modules, not ease it, and even make it harder to deal with, since JS tree-shakers are no doubt more mature than their wasm counterparts (if they exist at all). Gary, I'm going to go out on a limb and presume to speak for the GopherJS maintainers and answer your initial question:
And the answer is: More than anyone is willing to put in. I think everyone will tell you that go/wasm is the future of Go on the browser (or Node), and that's where all the current eyeballs are pointed. This doesn't really help you, and as noted really pretty much makes it worse (at the moment), but I think it's better to acknowledge reality. All that said, check in the #webassembly Gophers Slack channel for discussion about the TinyGo dialect, which has wasm output that's downright, well, tiny — in the kilobytes range. So there is hope. |
This is an aspirational request. That is I have not idea how hard this is, but how ever complex I think it is, its probably more complex (even taking the previous statement into account).
Take a look at https://prepack.io/. It has the promise of removing the bloat. eg from of the standard libraries.
However, even the simplest gopherjs'ed code doesn't pass muster. Two examples below.
Both examples use the following html.
Ex 1
The gopsherjs code works as expected.
The prepack js logs to console and then throw an exception. That looks to me like a Go panic.
To reproduce
Ex 2
Example two is actually the first thing I tried.
Same as above but used godom.
The Gopherjs generated code works just fine.
But prepack won't evaluate it.
PP0012 says
I'm sure this means something to people who know javascript ;-)
The text was updated successfully, but these errors were encountered: