Skip to content

Conversation

allenhumphreys
Copy link
Collaborator

@allenhumphreys allenhumphreys commented Jul 28, 2025

Motivation

  1. realm-core takes a long time to build
  2. SPM doesn't let us specify that for a particular dependency we do NOT want a debug build
  3. Realm is VERY VERY slow when built for debug, which is fine for them, but when developing the app, it leads to ambiguity as to whether our implementation of realm is slow, or if it's just the realm debug build.

Solution

Use Realm & realm-core binary dependencies!

Explanation

realm-swift has 2 products:

  1. Realm (realm-core is statically linked)
  2. RealmSwift

Realm depends on realm-core and is written in Objective-C++.

RealmSwift depends on Realm.

After the versions are released, Realm is available as a binary on the realm-swift release. Swapping in that binary means we will get release build of Realm and realm-core. RealmSwift will still be built from source because they're not using library evolution or whatever which means you need a specific swift compiler binary output to match to your Xcode version. RealmSwift is actually a relatively thin wrapper around the other 2 libraries and doesn't contribute a lot to the performance ambiguity.

Other approach explored in #730

@allenhumphreys allenhumphreys force-pushed the realm-as-fork-partial-binary branch from 452fdbb to aa5af1b Compare July 28, 2025 14:39
@allenhumphreys allenhumphreys force-pushed the realm-as-fork-partial-binary branch 3 times, most recently from 4de5485 to 887c344 Compare August 18, 2025 17:14
@allenhumphreys allenhumphreys changed the title Use custom of fork of realm with pre-built Realm binary, source RealmSwift Use realm-swfit with Realm.xcframework binaryTarget Aug 18, 2025
@allenhumphreys allenhumphreys changed the title Use realm-swfit with Realm.xcframework binaryTarget Use realm-swift with Realm.xcframework binaryTarget Aug 18, 2025
@allenhumphreys allenhumphreys force-pushed the realm-as-fork-partial-binary branch from 887c344 to f163c13 Compare August 18, 2025 17:15
@allenhumphreys allenhumphreys marked this pull request as ready for review August 18, 2025 17:27
@insidegui
Copy link
Owner

It's amazing how much faster clean builds are with this patch ❤️

@insidegui insidegui merged commit decf6cd into master Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants