mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
4de42be688
MapLibre ships as a dynamic framework, so being named in the app's load commands means dyld loads it before main runs on every launch: 7.3 MB paged in, 133 C++ static initialisers run and its classes registered, all for a map that only appears once a location screen is opened. Measured on an iPhone 17 Pro with two otherwise identical probe apps launched alternately, linking MapLibre takes pre-main from 11.1 ms to 23.2 ms, and on a cold launch from 32.9 ms to 60.7 ms. Loading it on demand brings pre-main back to the 11.1 ms baseline and moves the roughly 11 ms it costs to dlopen to the moment the map first appears. MapLibreShim is now embedded but not linked, and the app resolves the shim through the ObjC runtime after dlopen-ing it. MapLibre stays in the bundle as an embed-only framework reference so the shim's load command can resolve against it, expressed as an implicit framework because xcodegen can't describe embed-without-link for a package product. Timeline location messages already use the static tile view, which never touched MapLibre, so the shim only loads for interactive maps.