junkdog / artemis-odb

A continuation of the popular Artemis ECS framework
BSD 2-Clause "Simplified" License
769 stars 109 forks source link

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

Open DaanVanYperen opened 2 years ago

DaanVanYperen commented 2 years ago

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.