From dfbe32c6425b3ef5f3fb7daf0b2a1fb3f64752d4 Mon Sep 17 00:00:00 2001 From: Clint Branham Date: Wed, 29 Jul 2026 22:58:05 -0500 Subject: [PATCH] Define NDEBUG for release builds of the SQLCipher C target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SwiftPM does not define NDEBUG for C targets even in release configuration, so sqlite3.c ships with its internal assert()s enabled — SQLite documents roughly a 3x overhead with assertions on. The autoconf and CMake builds of SQLCipher both compile with NDEBUG in production; this brings the SwiftPM build in line, gated on .release so debug builds keep the asserts. --- Package.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Package.swift b/Package.swift index 08b5f4e..0892b63 100644 --- a/Package.swift +++ b/Package.swift @@ -4,6 +4,11 @@ import PackageDescription /// Compile-time options /// - seealso: [Recommended Compile-time Options](https://sqlite.org/compile.html#recommended_compile_time_options) let compileTimeOptions: [CSetting] = [ + // SwiftPM does not define NDEBUG for C targets even in release + // builds, so sqlite3.c ships with its internal assert()s (and their + // documented ~3x overhead) enabled. Compile them out for release, + // matching what the autoconf/CMake builds do. + .define("NDEBUG", .when(configuration: .release)), // https://sqlite.org/compile.html#dqs .define("SQLITE_DQS", to: "0", .when(traits: ["DQS_0"])), .define("SQLITE_DQS", to: "1", .when(traits: ["DQS_1"])),