I am preparing a talk for Swift Connection in September, about data serialization.
So, I wanted to measure things.
Therefore I decided to use the (somewhat) new Benchmark package.
It has some weird idiosyncrasies (what package doesn't), but it's quite nice... until you try to run some CoreServices functions (CoreData, remember), because it can't run in macOS apps.
Why? After a couple of hours I came to the conclusion that it requires some entitlement / privileged mode.
So, no sweat, let's include it in a "real" Xcode project for an app.
Except, no, because Benchmark uses jemalloc, which is unsigned and plays havoc with the regular debugger's way of looking at memory.
That's fine! There's an environment variable that disables jemalloc. All I need to do is pass it to the SPM build system.
Except no. Xcode doesn't pass along those. Neither user defined settings, nor any other way that I could find.
Script build phase then! And link to the built product manually!
Nope, the linker freaks out.
OK, so maybe I can build an app directly from the package itself?
Turns out, I can. But I kinda sorta need SwiftUI, which isn't my forte. Fine.
I can fork the Benchmark repo, disable jemalloc, build an app and run the measurements from the UI, which enables all the standard system features.
All I need to do is debug SwiftUI weirdness vis-a-vis long-running heavy background tasks 😭