Emerge Tools Profile picture
Emerge helps teams like @Spotify, @Duolingo, @Bumble, @Square, @Tinder, @Dropbox, @OpenAI & @CashApp build better mobile apps 🚀 Now a part of @getSentry 🧠

Sep 18, 13 tweets

Do we know why the Tesla iOS app is 760 MB? Can it be made smaller? Does a bear...nvm

This is a fun one, b/c the Tesla app does something not many other apps do

🔬 Taking a look at Tesla's app size + exploring

Immediately what jumps out is that ~30% of the app is `Tesla.pck` (241.2 MB)

A .pck is a file format for bundling Godot assets (scenes, scripts, shaders, etc)

Out of all the app's that we download, this is *by far* the largest .pck included in an app

We can see Godot included in all of Tesla's plugins + the main app target

This is how Tesla creates 3d model interactivity in the app

(remember this b/c we'll be coming back to the plugins)

The cool thing about a .pck (and the internet) is that we can actually decompile it to see raw assets + project structure.

We can even open it in Godot 👀

That's the Godot functionality - how could Tesla make the app smaller?

Remember how Godot was shipping in each Plugin? There are 5 plugins in Tesla for a total of 188.3 MB

The contents of each Plugin appear to be ~nearly~ identical

We can see this pretty clearly in the diff between v4.47.0 and v4.42.0 when the app increased by 50 MB

Each plugin added the same three `SwiftModules_*.bundle` files + had similar increases in binary size

A better way to look at it - the deep red is duplicate nodes (there are quite a few)

So ~190 MB (25%) of Tesla is coming from Plugins, which could be significantly reduced by using a dynamic framework

Other area for improvement - Tesla (uses RN) has a 96.6 MB main.jsbundle, but 26.7 MB is "debug info"

The debug info is meant to provide better stack traces, but it doesn't need to be in prod b/c you can provide it separately to crash reporters

A few other areas Tesla can reduce size

- Image optimization
- removing unneeded binary metadata
- minifying localizations

Some links if you're looking to dive in more:

Using Dynamic Frameworks
emergetools.com/blog/posts/mak…

gdsdecomp, the Godot decompiler we used
github.com/GDRETools/gdsd…

S/o @ssickle42 for the initial tag!

And lastly... now that we have our feet under us at @getsentry we're going to get back to active here so plz tag us if you want to know about an app!

You might even see a pretty different UI soon 👀👀👀

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling