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

[Performance] Reflection cache prevents GWT dead code elimination #645

Open
4 tasks
DaanVanYperen opened this issue Jul 21, 2021 · 0 comments
Open
4 tasks

Comments

@DaanVanYperen
Copy link
Collaborator

DaanVanYperen commented Jul 21, 2021

Summary

Optimized GWT removes dead code. The reflection cache contains call sites for all methods on all included types and this prevents dead code elimination for those types, leading to larger js files.

Details

A proof on my last game with method callsites suppressed from the odb cache only (see file size):
image
(Just removing the call-sites breaks the cache obviously but there might be some improvements to be had here).

Compiled with:

    compiler {
        strict = true
        disableCastChecking = true
        disableAggressiveOptimization = false
        draftCompile = false
        optimize = 9
    }

Options

Solving this might yield an estimated ~10-20% size decrease of the final js.
Definitely underlines why having two caches is a bad idea.

  • Document this behavior. It isn't too obvious if your knowledge of GWT is black-box.
  • Remove the need for a duplicate cache. Biggest win for ODB/GDX users. Problem is the forced GDX dep (is it a problem?).
  • Pruning the default included types where possible. We pull in large parts of the odb/gdx libraries by default.
  • Granular scoping of methods/fields to include? We use reflection for very specific use cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant