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

Reduce Recaf artifact size #882

Open
7 tasks
Col-E opened this issue Nov 20, 2024 · 1 comment
Open
7 tasks

Reduce Recaf artifact size #882

Col-E opened this issue Nov 20, 2024 · 1 comment

Comments

@Col-E
Copy link
Owner

Col-E commented Nov 20, 2024

Current size as of 2b3017f - 76 MB

Action items

  • -30 MB Remove unused fastutil collection implementations
    • Can create a shadowJar output filter for this
  • OpenRewrite options:
    • -10 MB Remove it + transitive dependencies
      • Need an alternative for parsing Java source
        • We could possibly make our own with the javac AST similiar to how OpenRewrite does things, but more lean
        • Go back to using JavaParser (~2 MB)
          • Not ideal since we would lose the partial AST read support we get with OpenRewrite
    • -7 MB Remove unused transitive dependencies
  • -9 MB Remove R8 in favor of dex
  • -4 MB Remove Jackson dependency and store AndroidRes data in JSON instead of XML
    • Will want to keep a tool in the Recaf repo to produce the JSON from the XML since the XML comes from the Android SDK releases. We can keep Jackson on the runtime path for this case, but not as a implementation/api dependency.
  • -4 MB Strip debug info from dependencies (after the above steps)
    • Not worth it because it makes bugs harder to diagnose if there is a crash/exception in the dependency code

Summary

Assuming all action items are taken (and best alternatives for multiple choice cases)

  • -53 MB in potential removed data leading to a 23 MB fat-jar
@Col-E
Copy link
Owner Author

Col-E commented Nov 20, 2024

For fastutil, these are the classes we and transitive dependencies import.

it.unimi.dsi.fastutil.Hash.Strategy;
it.unimi.dsi.fastutil.bytes.ByteIterator;
it.unimi.dsi.fastutil.chars.Char2IntArrayMap;
it.unimi.dsi.fastutil.chars.Char2IntMap;
it.unimi.dsi.fastutil.chars.Char2ObjectArrayMap;
it.unimi.dsi.fastutil.chars.Char2ObjectMap;
it.unimi.dsi.fastutil.chars.CharArraySet;
it.unimi.dsi.fastutil.chars.CharSet;
it.unimi.dsi.fastutil.ints.Int2IntArrayMap;
it.unimi.dsi.fastutil.ints.Int2IntLinkedOpenHashMap;
it.unimi.dsi.fastutil.ints.Int2IntMap;
it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
it.unimi.dsi.fastutil.ints.Int2IntSortedMap;
it.unimi.dsi.fastutil.ints.Int2ObjectAVLTreeMap;
it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry;
it.unimi.dsi.fastutil.ints.Int2ObjectMap;
it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap;
it.unimi.dsi.fastutil.ints.Int2ObjectSortedMap;
it.unimi.dsi.fastutil.ints.Int2ReferenceAVLTreeMap;
it.unimi.dsi.fastutil.ints.Int2ReferenceArrayMap;
it.unimi.dsi.fastutil.ints.Int2ReferenceLinkedOpenHashMap;
it.unimi.dsi.fastutil.ints.Int2ReferenceMap.Entry;
it.unimi.dsi.fastutil.ints.Int2ReferenceMap;
it.unimi.dsi.fastutil.ints.Int2ReferenceMaps;
it.unimi.dsi.fastutil.ints.Int2ReferenceOpenHashMap;
it.unimi.dsi.fastutil.ints.Int2ReferenceRBTreeMap;
it.unimi.dsi.fastutil.ints.Int2ReferenceSortedMap;
it.unimi.dsi.fastutil.ints.Int2ReferenceSortedMaps;
it.unimi.dsi.fastutil.ints.IntArrayList;
it.unimi.dsi.fastutil.ints.IntBidirectionalIterator;
it.unimi.dsi.fastutil.ints.IntList;
it.unimi.dsi.fastutil.ints.IntOpenHashSet;
it.unimi.dsi.fastutil.ints.IntSet;
it.unimi.dsi.fastutil.ints.IntSortedSet;
it.unimi.dsi.fastutil.longs.Long2ReferenceMap;
it.unimi.dsi.fastutil.longs.Long2ReferenceOpenHashMap;
it.unimi.dsi.fastutil.objects.Object2BooleanArrayMap;
it.unimi.dsi.fastutil.objects.Object2BooleanMap.Entry;
it.unimi.dsi.fastutil.objects.Object2BooleanMap;
it.unimi.dsi.fastutil.objects.Object2CharArrayMap;
it.unimi.dsi.fastutil.objects.Object2CharMap;
it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap;
it.unimi.dsi.fastutil.objects.Object2IntMap;
it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
it.unimi.dsi.fastutil.objects.Object2LongMap;
it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap;
it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenCustomHashMap;
it.unimi.dsi.fastutil.objects.Object2ObjectMap;
it.unimi.dsi.fastutil.objects.Object2ObjectRBTreeMap;
it.unimi.dsi.fastutil.objects.Object2ObjectSortedMap.FastSortedEntrySet;
it.unimi.dsi.fastutil.objects.Object2ReferenceLinkedOpenHashMap;
it.unimi.dsi.fastutil.objects.ObjectIterator;
it.unimi.dsi.fastutil.objects.Reference2BooleanMap.Entry;
it.unimi.dsi.fastutil.objects.Reference2BooleanMap;
it.unimi.dsi.fastutil.objects.Reference2BooleanMaps;
it.unimi.dsi.fastutil.objects.Reference2BooleanOpenHashMap;
it.unimi.dsi.fastutil.objects.Reference2IntLinkedOpenHashMap;
it.unimi.dsi.fastutil.objects.Reference2IntMap.Entry;
it.unimi.dsi.fastutil.objects.Reference2IntMap;
it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
it.unimi.dsi.fastutil.objects.Reference2ReferenceMap;
it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap;

Can probably do some basic analysis and see all the classes we need to support these uses and then toss everything else.

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