Menu

We removed 82 MB of native code that nothing imported
📰

We removed 82 MB of native code that nothing imported

DEV Community: reactnative·Danyal Muneer·4 days ago
#TKzwFnc3
#devtoreactnative#devto#dev#android#native
Reading 0:00
15s threshold

Our Android APK was carrying two native libraries that no JavaScript file used anymore.

librnskia.so : 41 MB across 4 ABIs. Skia stayed in package.json after we replaced our charts with plain react-native-svg rings and Views.

WebRTC ( libjingle_peerconnection_so.so ): 41 MB across ABIs. It was left over from a voice path we had already retired. Worse, it was being dlopen 'd 574 ms into every cold start , before the first frame, for code nothing imported.

The lesson

Autolinking compiles a library's native code into the APK whether or not any JS imports it. A package you "parked" in package.json for later is not free. You pay for it in download size and, sometimes, in startup time.

How we found them

Break the APK down by ABI, library and asset. We have a small script ( yarn perf apk ) that unzips the build and sorts every .so by size. Two 41 MB entries for features we no longer shipped stood out immediately.

Watch what loads at startup.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.