teavm icon indicating copy to clipboard operation
teavm copied to clipboard

Support for Dead-for-now (DFN) code splitting

Open liraz opened this issue 7 years ago • 2 comments

Does TeaVM support Dead-for-now (DFN) code splitting like GWT?

GWT.runAsync(new RunAsyncCallback() {
      public void onFailure(Throwable caught) {
         Window.alert("Code download failed");
      }

      public void onSuccess() {
         Window.alert("Hello, AJAX");
      }
});

Link to GWT docs on DFN code splitting: http://www.gwtproject.org/doc/latest/DevGuideCodeSplitting.html

If not, do you consider such feature being implemented?

It suppose to precompile chunks of javascript code that will be loaded once the piece of code that marked as split has been reached. Thus loading less JS code initially - and the user is gradually loading more JS code.

In big enterprise applications this is very important, since you don't know if the user will reach some parts of the application - and sometimes it can be a very large code base.

I think from debugger standpoint there's no problem, because you generate mapping for all the code - not regarding if it is being split or not.

liraz avatar Feb 20 '18 22:02 liraz

Sure, it's possible to implement code splitting and it's planned. But there's no ETA, since there aren't users who really want it right now. Please, describe your use case. Do you have any large application you successfully ported to TeaVM? How large is the generated JS file? Did you try to minify and gzip it? How large it becomes after that? How much time does it take to load such application on desktop and mobile platforms?

konsoletyper avatar Feb 26 '18 13:02 konsoletyper

Hi konsoletyper, I just looked for code-splitting with TeaVM (WASM), and as you are asking for users, here I am. Currently I have a GWT WebApp (https://m.brettspielwelt.de/) which dynamically loads the (source)code of the different games you can play there (only loading when used). Currently we have 80 different games, and I think even if every game compiles to just about 20-50K it is good for the user not to load about 3MB of code which will not be used. Nonetheless I will try to convert the "app" to TeaVM in the next time and have a look at the "footprint".

Great work keep it going!

ARMistice avatar Jun 14 '21 14:06 ARMistice