-
Notifications
You must be signed in to change notification settings - Fork 97
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
Modularize library #6
Comments
same issue!)) |
An update: There's the j2cl project which seems promising to me. After all the GWT transpiler itself is more or less discontinued (future GWT will be somewhat based on j2cl) and doesn't properly support newer Java versions. Thus, elkjs has to transition to a different transpiler anyway. However, getting everything to work (if possible) with j2cl seems to be quite some effort. |
I am using elkjs + d3.js and the minified bundle is 2.1MB in size. If I use elk in widget for jupyter notebook I am gettitng around 8MB of minified javascript on nearly empty page. |
Unfortunately I don't see a modularized version of the algorithms itself any time soon. In addition to the necessity that the transpiler supports it, I see several further difficulties. I'll look into the In which way does it slow down the webpack build? Without being a webpack expert, can't you exclude elkjs from webpack itself (in particular, if you use a webworker)? I believe we do it like that in https://github.com/kieler/elkgraph-web |
In normal build yes. However I do not know how to do it in bundle for jupyter widget (and I do not think it is possible) https://github.com/Nic30/jupyter_widget_hwt/blob/master/js/webpack.config.js#L39 I guess that it takes 90s just because it is too big. https://travis-ci.org/github/Nic30/jupyter_widget_hwt/builds/708874010 |
Any chance instead of modularizing we could have elkjs-layered for example? Same as klayjs with one layered algorithm only but based on ELK... The size of this becomes 550Kb and rather straight-forward to accomplish it seems... What do you think? |
I guess I could do that. So far I was still hoping to find a proper solution instead of simply publishing duplicate builds. It still requires some effort though to properly automate the process. EDIT: I just double-checked the resulting file size. Did you achieve the 550kB with a build yourself or are you referring to my original comment, which seems inaccurate? For me removing all algorithms despite layered yields 1.3MB (instead of 1.4). This wouldn't justify the effort in my eyes (for layered at least). |
Hmm... i thought i got 550Kb but i was mistaken it is 1.3Mb :-( Makes me wonder how |
Regarding klayjs:
EMF is the largest factor, I presume. Also, ELK layered itself continuously increased in size. I thought about removing EMF from ELK itself for several reasons but that's probably at least a month's worth of effort. |
As to the original intent of this issue: By now, several bytecode to js/webassembly transpilers have emerged: bytecoder, TeaVM, JWebAssembly, to name what I'm aware of so far. I could imagine them being a viable alternative for the future, especially, since they allow compilation to web assembly as well. |
I wrote few scripts, which removes functions declarations from To make it possible I went through next steps:
I can share those two scripts if you interested |
@redexp Can you share your scripts? I would like to give that a try. Thank you! |
https://gist.github.com/redexp/7d4e7b7731c85e4ce8f29c26cb234fad first then run |
It would be nice to have have several modules instead of one large file:
core
,alg.layered
,alg.stress
, etc. However, I don't see any way to realize this with the current GWT compilation solution.Currently the library is about 1.3 MB in size (minified); about 600 kB for core and layered, and 100 kB for the remaining algorithms.
The text was updated successfully, but these errors were encountered: