How Can I Inspect the Size Impact of Symbols in an App Binary: A Practical Guide for Apple Developers

In the previous posts we talked about Build Pipeline, Jargon, Static Linker vs Dynamic Linker. In this post we’ll benefit from the knowledge gained about the app wrapper’s folder structure and the placement of all the different binaries (frameworks and main app’s executable) to know where to look for. New in this post is learning how to use the nm command to inspect and count the number of symbols of each binary....

August 11, 2023 · 9 min

Optimizing Binaries - How Does the Linker Help Reduce App Size? What are the different types of linking - Part Two

In the previous post we talked about how the linker’s selective loading helps solve the bloat issue. But there are some other limitations to static linking. Because of those limitations software engineers created Dynamic libraries and the Dynamic Linker. In this post we’ll go through some of those limitations and discuss the trade-offs between the two ways of linking and their sizing impact. Inspired by Link fast: Improve build and launch times - 15:47:...

July 4, 2023 · 9 min

Optimizing Binaries - How Does the Linker Help Reduce App Size? What are the different types of linking - Part One

In the previous post we talked about a problem with the linker: Linking a single function from a library could link to the entire library. This creates a lot of bloat. As a result some enhancements were made to linker. The enhancement was to be selective and only load symbols that you need. Inspired by Link fast: Improve build and launch times - 4:15: Selective Loading In a nutshell if you have the following source code written in C:...

July 4, 2023 · 6 min

Optimizing Binaries - Build Pipeline Jargon

To understand this post, I highly recommend everyone to watch the WWDC 2022 - Link fast: Improve build and launch times and WWDC 2018 - Behind the Scenes of the Xcode Build Process. They’re of the best talks I’ve ever seen. This post covers some of the jargon and how it all comes together. And even though I love making puzzles, I’ll justify why I picked it as my cover....

May 31, 2023 · 12 min

Optimizing Binaries - High Level Xcode Build Pipeline

This the first post of a series I’m doing on how to optimize your app’s binaries. The post is more of a high level intro. Depending on the action (build, run, test, profile, analyze, archive) of your scheme, the process will have all or some of the following steps: Dependency analysis What happens when you press build? So the first step is for the build system to take the build description, your Xcode project file....

May 3, 2023 · 4 min
Difference between an app bundle and a binary

Whats the Difference Between an App (bundle) and a Binary

A binary is the linked product of all your source code. It’s executable. You can run commands against it. An app, is merely a wrapper/directory, which includes that binary and other things. How do you create a binary? First it’s important to understand what a binary is. You’ve used them every day in the terminal. Examples: ls, cp, mkdir. You pass certain parameters to them. They don’t have any file extension....

March 28, 2023 · 3 min

The power and expressiveness of Swift ranges

Ranges in swift are super simple to create. Yet they come in various forms. let r1 = 1...3 let r2 = 1..<3 let r3 = ...3 let r4 = 3... let r5 = ..<3 Now they all have range like characteristics, but have slightly different traits. It’s because they’re actually different types. Different Range Types let r1 = 1...3 // ClosedRange<Int> let r2 = 1..<3 // Range<Int> let r3 = ....

March 10, 2023 · 6 min

How cp case-insensitivity can cause chaos!

Been doing Advent of Code in the last couple of days. I completed Day 6. I have been doing it from an Xcode project. However I was thinking it would be nice if I could do it from command line. So I started to do some code clean up. First I started with renaming the folder from AOC to aoc. I did: cp -r AOC aoc I saw a new aoc directory created....

December 6, 2022 · 4 min

How to Think Recursively - Part 2

Please read How to Think Recursively before reading this post. This post re-applies the steps mentioned in the previous post on a more challenging question. Question Return all possible ways we can generate a well-formed parenthesis? Examples: if n = 1 then we can only form () if n = 2 then we can form (()) and ()() if n = 3 then we can form ((())), (())(), ()(()), (()()), (), (), () Let’s try applying our 4 steps:...

November 15, 2022 · 5 min

How to Think Recursively - Part 1

These articles are about the gotchas I faced when trying to think recursively. The logic in principle should apply to most recursive problems. In this post, I will use the following question as a point of reference: Count how many ways you can climb a staircase. You can jump either one step at a time or two steps at a time. Example if there are 3 stair cases then you can either jump:...

November 15, 2022 · 9 min