AppKit State Restoration on macOS 14 Sonoma AppKit state restoration behaviour changed on macOS 14 Sonoma in a subtle way that can lead to apps not restoring their state correctly. The change can lead to silent breakages which can be hard to debug. Behavioural Changes The AppKit release notes for macOS 14 state: Secure coding is automatically enabled for restorable state for applications linked on…
“Premature Optimization” You might have come across the famous software optimisation quote popularised by Donald Knuth: Premature optimization is the root of all evil. – Sir Tony Hoare It has been commonly interpreted as “don’t think about performance in the beginning, you can fix any performance problem later”. This interpretation is completely and categorically…
Windows XP I have a lot of fond memories of Windows XP and after feeling nostalgic, I was happy to find out that it’s relatively easy to take it for a spin on an ARM64 Mac using QEMU . I decided to install XP and an assortment of classic software one final time, taking screenshots of the whole process. This included Firefox , Winamp , WinZip , mIRC , Borland Delphi and Visual C++ 6.0 .…
AppKit vs SwiftUI: The Question When writing a native macOS app, developers need to decide which UI framework to write new code in. AppKit, whose origins date back to 30yrs+ ago, feels like a dinosaur soon to be retired with the shiny SwiftUI waiting around corner to take over. Ghostty vs SwiftUI Mitchell Hashimoto has been working on a new cross-platform terminal written in Zig and posted a…
Why? A lot has changed since I’ve last updated my website. The current design dates back to July 2012, more than 10yrs ago. Not only has technology moved on since then, what I value and how I approach engineering has changed as well. While Jekyll has served me well, it was time to move to a more robust and actively maintained ecosystem that will hopefully last for another 10yrs. Simplicity…
TL;DR When describing the performance of systems, always prefer terms which are unambigious. Use “as fast as” speed ratios and “as long as” time ratios. Always use “faster” or “slower” when referring to speed, never time. When referring to time in percentage delta terms, explicitly state “time increased/decreased by X%”. Time ratio is…
TL;DR Getting accurate network metrics on macOS is possible using sysctl() with NET_RT_IFLIST2 . Traffic metrics are exposed in units of 1KiB to prevent fingerprinting (only for 3rd party programs). As of macOS Ventura 13.2.1, there’s a kernel bug which truncates traffic values at the 4GiB mark. Using getifaddrs() only exposes 32bit fields, so it’s not a viable API on modern systems.…
Auto Linking Explained When object files get linked at the final build stage, the linker needs to know which libraries to link against. For example, if you add #import <AppKit/AppKit.h> to an implementation file, you need to also add -framework AppKit to the linker flags. Auto Linking aims to remove the latter step, i.e., it aims to derive the library linker flags from the import statements in…
TL;DR Determinism plays an important role in the ability to cache output of compilation. Distributed caching and compilation enable quick iteration on large scale software. Computation of distributed cache keys is non-trivial as not all inputs are explicit. A suitable distributed cache fill strategy is required for consistently fast local builds. Deterministic Builds Deterministic builds can be…
TL;DR Universal deterministic builds require that all paths in artifacts must be repo checkout independent. On Apple platforms, the linker will insert absolute paths to object files in executables. In Xcode 11, Apple added a new linker option, -oso_prefix , that can relativise OSO absolute paths. Another source of non-determinism in object files are the OSO timestamp entries. Deterministic Builds…