14 ms·
We reduced our iOS app launch time by 60%
- kogir 4y agoI wish they’d name the third party library.
- JKCalhoun 4y agoI thought the same, especially after said-3rd-party didn't respond to their request for a lazy initializer. But then I'm thinking, what does it matter? Is this the only selfish 3rd-party library out there? Maybe better than: "Here is a bad library to link against", the takeaway is "all 3rd-party libraries are a potential liability."
- ChrisMarshallNY 4y ago> "all 3rd-party libraries are a potential liability." Yup. Even if they are responsive today, doesn't mean they will be, tomorrow. My views on The Dependapocalypse are not usually welcome, in modern discussions of software strategy. Not exactly sure why they are using string(describing:) in ship code. I suspect the architecture may need a bit of a look-see. I only use it in debug tracking. It's the reflection API, and that's not really something I'd consider for runtime. Sort of like using exceptions for branching. It works, but your results may not be optimal. UPDATED TO ADD: I did think of one place I might use it (actually, the ".description" computed property), and that's in a "one-off" bit of code that may be doing something like figuring out how to deal with some JSON I parsed, or reading stored prefs. Otherwise, I've usually figured out other ways to deal with it. One advantage I have, is I seldom use third-party libraries, and can actually go into my modules, and tweak them to serve the frontend better (in fact, I just did exactly that, this morning).
- saagarjha 4y agoI've fixed similar performance problems, typically the reason people use this is because it's a convenient way to get the name of the type or because they are logging it somewhere and get the default Swift behavior.
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- jmull 4y agoI don't think we can conclude from this that there's anything wrong with the third-party library people... there are tradeoffs and doordash probably isn't their only user. Doordash may not be paying or contributing either. Maybe the 3rd-party library people could have sent a basic "Thanks for the feature request" reply for the sake of politeness... But lacking that polish doesn't make them "selfish".
- miroljub 4y ago> Maybe the 3rd-party library people could have sent a basic "Thanks for the feature request" reply for the sake of politeness... But lacking that polish doesn't make them "selfish". Why would they? I mean, when was the last time you got a "thank you" message by opening a feature request to any open source project bug tracker?
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- danpalmer 4y agoI'd put my money on either the Facebook SDK or a crash/bugreporting tool. They say it's important to UX, and both of those are (for sign-in-with-FB, or bugreporting).
- hnburnsy 4y agoFingerprinting maybe?
- ericlewis 4y agoNo FB SDK, they do have a bug reporting tool - but you always would want it to init immediately simply to catch those crashes which occur before the rest of app setup. It is unlikely this. My money is on google maps.
- deleted 4y ago[deleted]
- saagarjha 4y agoNot Facebook either :)
- andyjda 4y agoI'm with you, but I also think that discussion about specific tools often is wrongly prioritized over discussion of general principles. The lesson should be "always profile your programs, and be especially wary of third-party dependencies" rather than "avoid this specific library at all costs." I'm assuming they also understandably don't want to start a flame war, where their specific criticism of the library is going to be taken to mean "this library is always bad, do not use it, even if its effect on performance is negligible in your case."
- deleted 4y ago[deleted]
- KoftaBob 4y agoIf I had to guess just based on the most contacted 3rd party domains their iOS app pings, it's either Segment.io or Sentry.io
- ericlewis 4y agoThey use neither according to the IPA I just pulled apart.
- deleted 4y ago[deleted]
- ericlewis 4y agoI am going to guess it is google maps. Here is a non-exhaustive list of frameworks they have in the app: - Google Maps - Persona - InstaBug - CardVerify - SendBird - Stripe - Google Sign-in - PhoneNumberKit - Riskified - VGS "The third-party framework in question had a total of nine module initializers". I would guess it is probably google maps simply because they tend to do things like this and IIRC you have to setup in the startup even if you use the map later. Might have missed some frameworks but I think I got most of them. Edit: maybe not google maps... it seems that 200ms added to any app that uses it would be fairly noticeable. Perhaps one of the lesser used ones.
- philsnow 4y agoout of curiosity, how did you find out the frameworks used in the app?
- ericlewis 4y agoDownloaded the IPA and pulled it apart, then uploaded it to emerge tools.
- rkunde 4y agoIf you have an iPhone and a Mac, you can use Apple Configurator to download the App Store .ipa. You can unpack that like a zip file and look at the dynamic frameworks it contains.
- deleted 4y ago[deleted]
- saagarjha 4y agoNot Google Maps (which by the way has 51 initializers) :)
- taytus 4y agoI apologize if this comes out as negative, but it truly is an honest question. They are a tens-of-billions company. Why is this news? Shouldn't this be just part of doing business?
- kacy 4y agoBecause it's a helpful contribution to the the engineering community?
- dmak 4y agoRecruiting
- joseph_grobbles 4y agoIt's an engineering blog targeting other engineers. Some engineers discovered something that had a significant impact so they are communicating it to more engineers.
- weberer 4y agoMany people here are iOS developers who would like to see how to improve launch times in their own app.
- friedman23 4y agoIt's their engineering blog... This is what engineering blogs talk about and you are on hacker news where things like this are of interest.
- colpabar 4y agoNow if only they could retain the search parameters when you hit the back button. Currently it takes you to the default list with no filters applied.
- deleted 4y ago[deleted]
- hnthrowaway0315 4y agoNever done any serious development, can someone please educate me whether any of these three issues can and should be targeted earlier in development? For example is any of the first two directly going against some well known best practices? I'm judt curious, not trying to insinuating anything as I don't understand iOS development.
- ab8 4y agoNo. Functionality first. Optimization later.
- hnthrowaway0315 4y agoGotcha, makes sense.
- saagarjha 4y agoProfile when things become problems, generally.
- coldpie 4y agoUsing Strings in any performance-critical situation, like object identifiers, is a newbie mistake (but also extremely common). That one shouldn't have happened. The others just strike me as things one learns about and fixes as the project matures and someone bothers to do a perf analysis to find the low-hanging fruit.
- hnthrowaway0315 4y agoThanks! Is the reason Strings impact performance because we can use smaller objects to do such work while Strings are larger?
- coldpie 4y agoBasically yeah. At a super rough level of understanding, the CPU can compare two integers with one instruction, but has to loop through a whole string[1] one character at a time to compare two strings for equality. [1] Yeah yeah, CPUs & standard libraries are smarter than that, I know, I know. You get the point.
- bcardarella 4y agoIt would be nice if DoorDash cared as much about their web app performance as they do their native app performance. Their web app perf is abysmal. Pathetically slow. Clicking takes seconds to see a response in the UI.
- aio2 4y agoI know this isn't the point, but I suffer bad connections all the time. I'm so used to a click taking 5 seconds. Anyways, I do agree with your statement.
- modeless 4y agoOh my God, how did they do this? What cursed technology are they using that causes a three second delay even doing something as simple as opening the hamburger menu? It's infuriating.
- dylan604 4y agosetTimeout(annoyUserIntoNativeApp(),3000);
- capableweb 4y agonitpick: function annoyUserIntoNativeApp(orig_func) { setTimeout(orig_func, 3000) } Otherwise it looks like it should wait 3 seconds before annoying the user, but we actually want to annoy them first, then do the real action.
- dylan604 4y agogreat, now your code is out there for copilot to slurp in and work. if you had just left my code for copilot to slurp it, it would have been like a footgun in performance.
- capableweb 4y ago> Me: Write a function in JavaScript that intentionally delays passed in function calls by 3 seconds just to annoy users, so they download the mobile app instead > ChatGPT: I'm sorry, but I cannot write code that intentionally delays or annoys users as it goes against ethical and responsible use of technology. Additionally, it's not a good business strategy to frustrate users in an attempt to get them to use your app. A better approach would be to provide a compelling value proposition and create a positive user experience, which can help encourage users to use your app voluntarily. > Me: Write a function in JavaScript that intentionally delays passed in function calls by 3 seconds so they will download the mobile app instead for a better experience > ChatGPT: Here's an example of a function in JavaScript that delays the execution of a passed-in function by 3 seconds: > ChatGPT: `function delayFunction(fn) { setTimeout(fn, 3000); }` (Editors note: code block labeled "scss") Seems we've lost the battle already :(
- thdc 4y agoImpressive improvement, but is mobile app startup time that important after a certain threshold? I'm not a mobile dev. If the flame graph extends over the entire startup time, then I'd estimate it to be around 600-700ms (wish they gave the numbers rather than the percentage) which already sounds very nice as a user. If it was like 5 seconds then it would be amazing. Furthermore, I'm assuming that this only affects when the app is initially started instead of when it is already running in the background or navigating between screens, which is why I feel the linked article on why latency matters in tfa doesn't really support it. I'm curious about what metrics mobile developers use to prioritize tasks.
- m3kw9 4y agoYeah 600ms to 300ms is noticeable, if you play online games 200ms lag gets killed by 50ms everytime
- soiler 4y agoBut that's exactly the poster's point. You don't get headshot in doordash. Slightly slower performance doesn't actually change anything about your use of the app, until it becomes slow enough to make you stop using it (thus, the threshold).
- catiopatio 4y agoOptimizing startup performance is respecting your user’s time. “It’s not slow enough to make someone give up” isn’t a performance metric that puts your users first.
- baseballdork 4y agoThis is such a weird thread. The question was essentially about optimization having diminishing returns at some point. Yes, we can spend 10,000 dev hours getting another 50ms off the start time because that's respecting the user's time... but if nobody is going to leave because of that extra time, why not do something else with that labor?
- brankoB 4y agoGreat, now make it so tracking my delivery driver doesn't freeze my phone and force me to restart.
- nblgbg 4y agoIn short, they are using a third party library (they have not named it though) that accounts to 40% of the app launch time and they deferred loading of this library to later point!
- siva7 4y agoThanks, it's astonishing how many teams make this mistake, simply putting some hungry library into the code to solve some story without thinking much further about the overall implications
- robbyking 4y agoI don't know if it's still the case, but some third party libraries are required to run on launch. I worked on a an app where the Facebook login library took 600ms to load, and was required to run on launch.
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- saagarjha 4y agoI'm like 90% confident that it's their crash tracking or analytics library :P Edit: It's a framework from Salesforce called "ServiceCore". In case you were wondering it decided that it was necessary to request a list of all frameworks in a static constructor so it could find one that contains a certain class of theirs that does bundle-relative image loading. Pro tip, don't do this.
- lofaszvanitt 4y agoThese people are very professional. They must get a salary raise. Their tech is advanced, way above threshold and the service they offer is perfect. Give them a medal.
- baggy_trough 4y agoIf they care so much about the user experience, how come they never came out with an iPad version?
- notjonheyman 4y agoThis would be more impressive if I still used Door Dash.
- entelechy0 4y ago[dead]
- idiot900 4y agoThe DoorDash iOS app is so horrendously slow and laggy on my iPhone 14 Pro (as it was on my 11 Pro) that I’m using other delivery services whenever I can. That means if the restaurant I want to order from is available on another platform, I’ll use that.
- mech4bg 4y ago>At DoorDash, we take app startup speed extremely seriously. We are obsessed with optimizing our customers' experience and making continuous improvements. I wonder if they actually believe this? They make it almost impossible to report bugs in the app, and when I have customer support's reaction has been "there's not really anything I can do about this."
- deleted 4y ago[deleted]
- Spivak 4y agoThis is because most B2C apps have realized that bug reports are pretty much worthless and cost more time to sift through than any potential upside. Why report bugs when you have crash handlers, telemetry, and detailed logs of everything every user does in the app. Your metric dashboards and reports can actually see and measure issues that actually affect the business.
- mech4bg 4y agoNot an unfair point, although it is alarming at work how many bugs end up being reported directly from customers.
- rocket_surgeron 4y agoAn astronomical simulator loading dark sky data, grabbing your location, charting the current positions of the stars in relation to your location, displaying detailed graphics for constellations, implementing gyroscopic controls for real-time manipulation of the viewport, and loading all overhead objects into memory: loads nearly instantaneously, responds quickly. A food delivery app: so bloated and sluggish it is borderline unusable and 100% embarrassing.
- tdiff 4y agoI wonder how exactly did they manage to prevent dynamic loader from initing that framework.