add
This commit is contained in:
-113
@@ -1,113 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class ArgumentsTests: XCTestCase {
|
||||
static let shortString = "foo"
|
||||
static let longString = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus consectetur felis eget nibh aliquet ullamcorper. Nam sodales, tellus a cursus tincidunt, arcu purus suscipit elit, nec congue erat ipsum a purus."
|
||||
|
||||
var dbDirectoryPath: String!
|
||||
var dbQueue: DatabaseQueue!
|
||||
|
||||
override func setUpWithError() throws {
|
||||
let dbDirectoryName = "ArgumentsTests-\(ProcessInfo.processInfo.globallyUniqueString)"
|
||||
dbDirectoryPath = (NSTemporaryDirectory() as NSString).appendingPathComponent(dbDirectoryName)
|
||||
try FileManager.default.createDirectory(atPath: dbDirectoryPath, withIntermediateDirectories: true)
|
||||
let dbPath = (dbDirectoryPath as NSString).appendingPathComponent("db.sqlite")
|
||||
dbQueue = try DatabaseQueue(path: dbPath)
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
dbQueue = nil
|
||||
try FileManager.default.removeItem(atPath: dbDirectoryPath)
|
||||
}
|
||||
|
||||
func test_shortString_legacy_performance_() throws {
|
||||
try dbQueue.write { db in
|
||||
try db.execute(sql: "CREATE TABLE t(a)")
|
||||
|
||||
let statement = try db.makeStatement(sql: "INSERT INTO t(a) VALUES (?)")
|
||||
let arguments: StatementArguments = [Self.shortString]
|
||||
measure {
|
||||
for _ in 0..<1_000_000 {
|
||||
// Simulate old implementation of statement.execute(arguments: arguments)
|
||||
try! statement.setArguments(arguments)
|
||||
try! statement.execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func test_shortString_SQLITE_STATIC_performance() throws {
|
||||
try dbQueue.write { db in
|
||||
try db.execute(sql: "CREATE TABLE t(a)")
|
||||
|
||||
let statement = try db.makeStatement(sql: "INSERT INTO t(a) VALUES (?)")
|
||||
let arguments: StatementArguments = [Self.shortString]
|
||||
measure {
|
||||
for _ in 0..<1_000_000 {
|
||||
try! statement.execute(arguments: arguments)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func test_shortString_SQLITE_TRANSIENT_performance() throws {
|
||||
try dbQueue.write { db in
|
||||
try db.execute(sql: "CREATE TABLE t(a)")
|
||||
|
||||
let statement = try db.makeStatement(sql: "INSERT INTO t(a) VALUES (?)")
|
||||
let arguments: StatementArguments = [Self.shortString]
|
||||
try statement.setArguments(arguments)
|
||||
measure {
|
||||
for _ in 0..<1_000_000 {
|
||||
try! statement.execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func test_longString_legacy_performance_() throws {
|
||||
try dbQueue.write { db in
|
||||
try db.execute(sql: "CREATE TABLE t(a)")
|
||||
|
||||
let statement = try db.makeStatement(sql: "INSERT INTO t(a) VALUES (?)")
|
||||
let arguments: StatementArguments = [Self.longString]
|
||||
measure {
|
||||
for _ in 0..<1_000_000 {
|
||||
// Simulate old implementation of statement.execute(arguments: arguments)
|
||||
try! statement.setArguments(arguments)
|
||||
try! statement.execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func test_longString_SQLITE_STATIC_performance() throws {
|
||||
try dbQueue.write { db in
|
||||
try db.execute(sql: "CREATE TABLE t(a)")
|
||||
|
||||
let statement = try db.makeStatement(sql: "INSERT INTO t(a) VALUES (?)")
|
||||
let arguments: StatementArguments = [Self.longString]
|
||||
measure {
|
||||
for _ in 0..<1_000_000 {
|
||||
try! statement.execute(arguments: arguments)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func test_longString_SQLITE_TRANSIENT_performance() throws {
|
||||
try dbQueue.write { db in
|
||||
try db.execute(sql: "CREATE TABLE t(a)")
|
||||
|
||||
let statement = try db.makeStatement(sql: "INSERT INTO t(a) VALUES (?)")
|
||||
let arguments: StatementArguments = [Self.longString]
|
||||
try! statement.setArguments(arguments)
|
||||
measure {
|
||||
for _ in 0..<1_000_000 {
|
||||
try! statement.execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
class DateParsingTests: XCTestCase {
|
||||
|
||||
/// Selects many dates
|
||||
let request = """
|
||||
WITH RECURSIVE
|
||||
cnt(x) AS (
|
||||
SELECT 1
|
||||
UNION ALL
|
||||
SELECT x+1 FROM cnt
|
||||
LIMIT 50000
|
||||
)
|
||||
SELECT '2018-04-20 14:47:12.345' FROM cnt;
|
||||
"""
|
||||
|
||||
func testParseDateComponents() {
|
||||
measure {
|
||||
try! DatabaseQueue().inDatabase { db in
|
||||
let cursor = try DatabaseDateComponents.fetchCursor(db, sql: request)
|
||||
while try cursor.next() != nil { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testParseDate() {
|
||||
measure {
|
||||
try! DatabaseQueue().inDatabase { db in
|
||||
let cursor = try Date.fetchCursor(db, sql: request)
|
||||
while try cursor.next() != nil { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
#if GRDB_COMPARE
|
||||
import SQLite
|
||||
#endif
|
||||
|
||||
private let expectedRowCount = 200_000
|
||||
|
||||
/// Here we test the extraction of row values by column name.
|
||||
class FetchNamedValuesTests: XCTestCase {
|
||||
|
||||
func testGRDB() throws {
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBPerformanceTests.sqlite")
|
||||
try generateSQLiteDatabaseIfMissing(at: url, insertedRowCount: expectedRowCount)
|
||||
let dbQueue = try DatabaseQueue(path: url.path)
|
||||
|
||||
measure {
|
||||
var count = 0
|
||||
|
||||
try! dbQueue.inDatabase { db in
|
||||
let rows = try Row.fetchCursor(db, sql: "SELECT * FROM item")
|
||||
while let row = try rows.next() {
|
||||
_ = row["i0"] as Int
|
||||
_ = row["i1"] as Int
|
||||
_ = row["i2"] as Int
|
||||
_ = row["i3"] as Int
|
||||
_ = row["i4"] as Int
|
||||
_ = row["i5"] as Int
|
||||
_ = row["i6"] as Int
|
||||
_ = row["i7"] as Int
|
||||
_ = row["i8"] as Int
|
||||
_ = row["i9"] as Int
|
||||
|
||||
count += 1
|
||||
}
|
||||
}
|
||||
|
||||
XCTAssertEqual(count, expectedRowCount)
|
||||
}
|
||||
}
|
||||
|
||||
#if GRDB_COMPARE
|
||||
func testFMDB() throws {
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBPerformanceTests.sqlite")
|
||||
try generateSQLiteDatabaseIfMissing(at: url, insertedRowCount: expectedRowCount)
|
||||
let dbQueue = FMDatabaseQueue(path: url.path)!
|
||||
|
||||
measure {
|
||||
var count = 0
|
||||
|
||||
dbQueue.inDatabase { db in
|
||||
let rs = try! db.executeQuery("SELECT * FROM item", values: nil)
|
||||
while rs.next() {
|
||||
_ = rs.long(forColumn: "i0")
|
||||
_ = rs.long(forColumn: "i1")
|
||||
_ = rs.long(forColumn: "i2")
|
||||
_ = rs.long(forColumn: "i3")
|
||||
_ = rs.long(forColumn: "i4")
|
||||
_ = rs.long(forColumn: "i5")
|
||||
_ = rs.long(forColumn: "i6")
|
||||
_ = rs.long(forColumn: "i7")
|
||||
_ = rs.long(forColumn: "i8")
|
||||
_ = rs.long(forColumn: "i9")
|
||||
|
||||
count += 1
|
||||
}
|
||||
}
|
||||
|
||||
XCTAssertEqual(count, expectedRowCount)
|
||||
}
|
||||
}
|
||||
|
||||
func testSQLiteSwift() throws {
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBPerformanceTests.sqlite")
|
||||
try generateSQLiteDatabaseIfMissing(at: url, insertedRowCount: expectedRowCount)
|
||||
let db = try Connection(url.path)
|
||||
|
||||
measure {
|
||||
var count = 0
|
||||
|
||||
for row in try! db.prepare(itemTable) {
|
||||
_ = row[i0Column]
|
||||
_ = row[i1Column]
|
||||
_ = row[i2Column]
|
||||
_ = row[i3Column]
|
||||
_ = row[i4Column]
|
||||
_ = row[i5Column]
|
||||
_ = row[i6Column]
|
||||
_ = row[i7Column]
|
||||
_ = row[i8Column]
|
||||
_ = row[i9Column]
|
||||
|
||||
count += 1
|
||||
}
|
||||
|
||||
XCTAssertEqual(count, expectedRowCount)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
-147
@@ -1,147 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
#if GRDB_COMPARE
|
||||
import SQLite
|
||||
#endif
|
||||
|
||||
private let expectedRowCount = 200_000
|
||||
|
||||
/// Here we test the extraction of row values by column index.
|
||||
class FetchPositionalValuesTests: XCTestCase {
|
||||
|
||||
func testSQLite() throws {
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBPerformanceTests.sqlite")
|
||||
try generateSQLiteDatabaseIfMissing(at: url, insertedRowCount: expectedRowCount)
|
||||
var connection: OpaquePointer? = nil
|
||||
sqlite3_open_v2(url.path, &connection, 0x00000004 /*SQLITE_OPEN_CREATE*/ | 0x00000002 /*SQLITE_OPEN_READWRITE*/, nil)
|
||||
|
||||
let options = XCTMeasureOptions()
|
||||
options.iterationCount = 50
|
||||
measure(options: options) {
|
||||
var count = 0
|
||||
var statement: OpaquePointer? = nil
|
||||
sqlite3_prepare_v2(connection, "SELECT * FROM item", -1, &statement, nil)
|
||||
|
||||
loop: while true {
|
||||
switch sqlite3_step(statement) {
|
||||
case 101 /*SQLITE_DONE*/:
|
||||
break loop
|
||||
case 100 /*SQLITE_ROW*/:
|
||||
_ = sqlite3_column_int64(statement, 0)
|
||||
_ = sqlite3_column_int64(statement, 1)
|
||||
_ = sqlite3_column_int64(statement, 2)
|
||||
_ = sqlite3_column_int64(statement, 3)
|
||||
_ = sqlite3_column_int64(statement, 4)
|
||||
_ = sqlite3_column_int64(statement, 5)
|
||||
_ = sqlite3_column_int64(statement, 6)
|
||||
_ = sqlite3_column_int64(statement, 7)
|
||||
_ = sqlite3_column_int64(statement, 8)
|
||||
_ = sqlite3_column_int64(statement, 9)
|
||||
break
|
||||
default:
|
||||
XCTFail()
|
||||
}
|
||||
|
||||
count += 1
|
||||
}
|
||||
|
||||
sqlite3_finalize(statement)
|
||||
|
||||
XCTAssertEqual(count, expectedRowCount)
|
||||
}
|
||||
|
||||
sqlite3_close(connection)
|
||||
}
|
||||
|
||||
func testGRDB() throws {
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBPerformanceTests.sqlite")
|
||||
try generateSQLiteDatabaseIfMissing(at: url, insertedRowCount: expectedRowCount)
|
||||
let dbQueue = try DatabaseQueue(path: url.path)
|
||||
|
||||
let options = XCTMeasureOptions()
|
||||
options.iterationCount = 50
|
||||
measure(options: options) {
|
||||
var count = 0
|
||||
|
||||
try! dbQueue.inDatabase { db in
|
||||
let rows = try Row.fetchCursor(db, sql: "SELECT * FROM item")
|
||||
while let row = try rows.next() {
|
||||
_ = row[0] as Int
|
||||
_ = row[1] as Int
|
||||
_ = row[2] as Int
|
||||
_ = row[3] as Int
|
||||
_ = row[4] as Int
|
||||
_ = row[5] as Int
|
||||
_ = row[6] as Int
|
||||
_ = row[7] as Int
|
||||
_ = row[8] as Int
|
||||
_ = row[9] as Int
|
||||
|
||||
count += 1
|
||||
}
|
||||
}
|
||||
|
||||
XCTAssertEqual(count, expectedRowCount)
|
||||
}
|
||||
}
|
||||
|
||||
#if GRDB_COMPARE
|
||||
func testFMDB() throws {
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBPerformanceTests.sqlite")
|
||||
try generateSQLiteDatabaseIfMissing(at: url, insertedRowCount: expectedRowCount)
|
||||
let dbQueue = FMDatabaseQueue(path: url.path)!
|
||||
|
||||
measure {
|
||||
var count = 0
|
||||
|
||||
dbQueue.inDatabase { db in
|
||||
let rs = try! db.executeQuery("SELECT * FROM item", values: nil)
|
||||
while rs.next() {
|
||||
_ = rs.long(forColumnIndex: 0)
|
||||
_ = rs.long(forColumnIndex: 1)
|
||||
_ = rs.long(forColumnIndex: 2)
|
||||
_ = rs.long(forColumnIndex: 3)
|
||||
_ = rs.long(forColumnIndex: 4)
|
||||
_ = rs.long(forColumnIndex: 5)
|
||||
_ = rs.long(forColumnIndex: 6)
|
||||
_ = rs.long(forColumnIndex: 7)
|
||||
_ = rs.long(forColumnIndex: 8)
|
||||
_ = rs.long(forColumnIndex: 9)
|
||||
|
||||
count += 1
|
||||
}
|
||||
}
|
||||
|
||||
XCTAssertEqual(count, expectedRowCount)
|
||||
}
|
||||
}
|
||||
|
||||
func testSQLiteSwift() throws {
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBPerformanceTests.sqlite")
|
||||
try generateSQLiteDatabaseIfMissing(at: url, insertedRowCount: expectedRowCount)
|
||||
let db = try Connection(url.path)
|
||||
|
||||
measure {
|
||||
var count = 0
|
||||
|
||||
for row in try! db.prepare("SELECT * FROM item") {
|
||||
// Direct Int extraction is not supported.
|
||||
_ = Int(row[0] as! Int64)
|
||||
_ = Int(row[1] as! Int64)
|
||||
_ = Int(row[2] as! Int64)
|
||||
_ = Int(row[3] as! Int64)
|
||||
_ = Int(row[4] as! Int64)
|
||||
_ = Int(row[5] as! Int64)
|
||||
_ = Int(row[6] as! Int64)
|
||||
_ = Int(row[7] as! Int64)
|
||||
_ = Int(row[8] as! Int64)
|
||||
_ = Int(row[9] as! Int64)
|
||||
|
||||
count += 1
|
||||
}
|
||||
|
||||
XCTAssertEqual(count, expectedRowCount)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
-119
@@ -1,119 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
#if GRDB_COMPARE
|
||||
import CoreData
|
||||
import RealmSwift
|
||||
#endif
|
||||
|
||||
private let expectedRowCount = 200_000
|
||||
|
||||
/// Here we test the extraction of model objects able to tell if they were
|
||||
/// modified since last fetched from the database.
|
||||
class FetchRecordClassTests: XCTestCase {
|
||||
|
||||
func testGRDB() throws {
|
||||
/// Record is the superclass of objects able to tell if they were
|
||||
/// modified since last fetched from the database.
|
||||
class Item: Record {
|
||||
var i0: Int
|
||||
var i1: Int
|
||||
var i2: Int
|
||||
var i3: Int
|
||||
var i4: Int
|
||||
var i5: Int
|
||||
var i6: Int
|
||||
var i7: Int
|
||||
var i8: Int
|
||||
var i9: Int
|
||||
|
||||
override class var databaseTableName: String {
|
||||
"item"
|
||||
}
|
||||
|
||||
required init(row: GRDB.Row) throws {
|
||||
i0 = row["i0"]
|
||||
i1 = row["i1"]
|
||||
i2 = row["i2"]
|
||||
i3 = row["i3"]
|
||||
i4 = row["i4"]
|
||||
i5 = row["i5"]
|
||||
i6 = row["i6"]
|
||||
i7 = row["i7"]
|
||||
i8 = row["i8"]
|
||||
i9 = row["i9"]
|
||||
try super.init(row: row)
|
||||
}
|
||||
}
|
||||
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBPerformanceTests.sqlite")
|
||||
try generateSQLiteDatabaseIfMissing(at: url, insertedRowCount: expectedRowCount)
|
||||
let dbQueue = try DatabaseQueue(path: url.path)
|
||||
|
||||
measure {
|
||||
let items = try! dbQueue.inDatabase { db in
|
||||
try Item.fetchAll(db)
|
||||
}
|
||||
XCTAssertEqual(items.count, expectedRowCount)
|
||||
XCTAssertEqual(items[0].i0, 0)
|
||||
XCTAssertEqual(items[1].i1, 1)
|
||||
XCTAssertEqual(items[expectedRowCount-1].i9, expectedRowCount-1)
|
||||
}
|
||||
}
|
||||
|
||||
#if GRDB_COMPARE
|
||||
func testCoreData() throws {
|
||||
let modelURL = Bundle(for: type(of: self)).url(forResource: "PerformanceModel", withExtension: "momd")!
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBCoreDataPerformanceTests.sqlite")
|
||||
try generateCoreDataDatabaseIfMissing(at: url, fromModelAt: modelURL, insertedRowCount: expectedRowCount)
|
||||
let mom = NSManagedObjectModel(contentsOf: modelURL)!
|
||||
let psc = NSPersistentStoreCoordinator(managedObjectModel: mom)
|
||||
try psc.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: url, options: nil)
|
||||
let moc = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
|
||||
moc.persistentStoreCoordinator = psc
|
||||
|
||||
measure {
|
||||
let request = NSFetchRequest<NSFetchRequestResult>(entityName: "Item")
|
||||
let items = try! moc.fetch(request)
|
||||
for item in items {
|
||||
let item = item as AnyObject
|
||||
_ = item.value(forKey: "i0")
|
||||
_ = item.value(forKey: "i1")
|
||||
_ = item.value(forKey: "i2")
|
||||
_ = item.value(forKey: "i3")
|
||||
_ = item.value(forKey: "i4")
|
||||
_ = item.value(forKey: "i5")
|
||||
_ = item.value(forKey: "i6")
|
||||
_ = item.value(forKey: "i7")
|
||||
_ = item.value(forKey: "i8")
|
||||
_ = item.value(forKey: "i9")
|
||||
}
|
||||
XCTAssertEqual(items.count, expectedRowCount)
|
||||
}
|
||||
}
|
||||
|
||||
func testRealm() throws {
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBRealmPerformanceTests.realm")
|
||||
try generateRealmDatabaseIfMissing(at: url, insertedRowCount: expectedRowCount)
|
||||
let realm = try Realm(fileURL: url)
|
||||
|
||||
measure {
|
||||
let items = realm.objects(RealmItem.self)
|
||||
var count = 0
|
||||
for item in items {
|
||||
count += 1
|
||||
_ = item.i0
|
||||
_ = item.i1
|
||||
_ = item.i2
|
||||
_ = item.i3
|
||||
_ = item.i4
|
||||
_ = item.i5
|
||||
_ = item.i6
|
||||
_ = item.i7
|
||||
_ = item.i8
|
||||
_ = item.i9
|
||||
}
|
||||
XCTAssertEqual(count, expectedRowCount)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
private let expectedRowCount = 200_000
|
||||
|
||||
/// Here we test the extraction of Decodable GRDB records.
|
||||
class FetchRecordDecodableTests: XCTestCase {
|
||||
|
||||
func testGRDB() throws {
|
||||
struct Item: Decodable, FetchableRecord, TableRecord {
|
||||
var i0: Int
|
||||
var i1: Int
|
||||
var i2: Int
|
||||
var i3: Int
|
||||
var i4: Int
|
||||
var i5: Int
|
||||
var i6: Int
|
||||
var i7: Int
|
||||
var i8: Int
|
||||
var i9: Int
|
||||
}
|
||||
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBPerformanceTests.sqlite")
|
||||
try generateSQLiteDatabaseIfMissing(at: url, insertedRowCount: expectedRowCount)
|
||||
let dbQueue = try DatabaseQueue(path: url.path)
|
||||
|
||||
measure {
|
||||
let items = try! dbQueue.inDatabase { db in
|
||||
try Item.fetchAll(db)
|
||||
}
|
||||
XCTAssertEqual(items.count, expectedRowCount)
|
||||
XCTAssertEqual(items[0].i0, 0)
|
||||
XCTAssertEqual(items[1].i1, 1)
|
||||
XCTAssertEqual(items[expectedRowCount-1].i9, expectedRowCount-1)
|
||||
}
|
||||
}
|
||||
}
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
private let expectedRowCount = 200_000
|
||||
|
||||
/// A record optimized for fetching performance
|
||||
private struct Item: Codable, FetchableRecord, PersistableRecord {
|
||||
var i0: Int
|
||||
var i1: Int
|
||||
var i2: Int
|
||||
var i3: Int
|
||||
var i4: Int
|
||||
var i5: Int
|
||||
var i6: Int
|
||||
var i7: Int
|
||||
var i8: Int
|
||||
var i9: Int
|
||||
|
||||
init(row: Row) {
|
||||
i0 = row[0]
|
||||
i1 = row[1]
|
||||
i2 = row[2]
|
||||
i3 = row[3]
|
||||
i4 = row[4]
|
||||
i5 = row[5]
|
||||
i6 = row[6]
|
||||
i7 = row[7]
|
||||
i8 = row[8]
|
||||
i9 = row[9]
|
||||
}
|
||||
|
||||
static let databaseSelection: [any SQLSelectable] = [
|
||||
Column("i0"),
|
||||
Column("i1"),
|
||||
Column("i2"),
|
||||
Column("i3"),
|
||||
Column("i4"),
|
||||
Column("i5"),
|
||||
Column("i6"),
|
||||
Column("i7"),
|
||||
Column("i8"),
|
||||
Column("i9"),
|
||||
]
|
||||
}
|
||||
|
||||
/// Here we test the extraction of a plain Swift struct
|
||||
class FetchRecordOptimizedTests: XCTestCase {
|
||||
func testGRDB() throws {
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBPerformanceTests.sqlite")
|
||||
try generateSQLiteDatabaseIfMissing(at: url, insertedRowCount: expectedRowCount)
|
||||
let dbQueue = try DatabaseQueue(path: url.path)
|
||||
|
||||
let options = XCTMeasureOptions()
|
||||
options.iterationCount = 50
|
||||
measure(options: options) {
|
||||
let items = try! dbQueue.inDatabase { db in
|
||||
try Item.fetchAll(db)
|
||||
}
|
||||
XCTAssertEqual(items.count, expectedRowCount)
|
||||
XCTAssertEqual(items[0].i0, 0)
|
||||
XCTAssertEqual(items[1].i1, 1)
|
||||
XCTAssertEqual(items[expectedRowCount-1].i9, expectedRowCount-1)
|
||||
}
|
||||
}
|
||||
}
|
||||
-177
@@ -1,177 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
#if GRDB_COMPARE
|
||||
import SQLite
|
||||
#endif
|
||||
|
||||
private let expectedRowCount = 200_000
|
||||
|
||||
private struct Item {
|
||||
var i0: Int
|
||||
var i1: Int
|
||||
var i2: Int
|
||||
var i3: Int
|
||||
var i4: Int
|
||||
var i5: Int
|
||||
var i6: Int
|
||||
var i7: Int
|
||||
var i8: Int
|
||||
var i9: Int
|
||||
}
|
||||
|
||||
// GRDB support
|
||||
extension Item: FetchableRecord, TableRecord {
|
||||
init(row: GRDB.Row) {
|
||||
i0 = row["i0"]
|
||||
i1 = row["i1"]
|
||||
i2 = row["i2"]
|
||||
i3 = row["i3"]
|
||||
i4 = row["i4"]
|
||||
i5 = row["i5"]
|
||||
i6 = row["i6"]
|
||||
i7 = row["i7"]
|
||||
i8 = row["i8"]
|
||||
i9 = row["i9"]
|
||||
}
|
||||
}
|
||||
|
||||
/// Here we test the extraction of a plain Swift struct
|
||||
class FetchRecordStructTests: XCTestCase {
|
||||
|
||||
func testSQLite() throws {
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBPerformanceTests.sqlite")
|
||||
try generateSQLiteDatabaseIfMissing(at: url, insertedRowCount: expectedRowCount)
|
||||
var connection: OpaquePointer? = nil
|
||||
sqlite3_open_v2(url.path, &connection, 0x00000004 /*SQLITE_OPEN_CREATE*/ | 0x00000002 /*SQLITE_OPEN_READWRITE*/, nil)
|
||||
|
||||
measure {
|
||||
var statement: OpaquePointer? = nil
|
||||
sqlite3_prepare_v2(connection, "SELECT * FROM item", -1, &statement, nil)
|
||||
|
||||
let columnNames = (Int32(0)..<10).map { String(cString: sqlite3_column_name(statement, $0)) }
|
||||
let index0 = Int32(columnNames.firstIndex(of: "i0")!)
|
||||
let index1 = Int32(columnNames.firstIndex(of: "i1")!)
|
||||
let index2 = Int32(columnNames.firstIndex(of: "i2")!)
|
||||
let index3 = Int32(columnNames.firstIndex(of: "i3")!)
|
||||
let index4 = Int32(columnNames.firstIndex(of: "i4")!)
|
||||
let index5 = Int32(columnNames.firstIndex(of: "i5")!)
|
||||
let index6 = Int32(columnNames.firstIndex(of: "i6")!)
|
||||
let index7 = Int32(columnNames.firstIndex(of: "i7")!)
|
||||
let index8 = Int32(columnNames.firstIndex(of: "i8")!)
|
||||
let index9 = Int32(columnNames.firstIndex(of: "i9")!)
|
||||
|
||||
var items = [Item]()
|
||||
loop: while true {
|
||||
switch sqlite3_step(statement) {
|
||||
case 101 /*SQLITE_DONE*/:
|
||||
break loop
|
||||
case 100 /*SQLITE_ROW*/:
|
||||
let item = Item(
|
||||
i0: Int(sqlite3_column_int64(statement, index0)),
|
||||
i1: Int(sqlite3_column_int64(statement, index1)),
|
||||
i2: Int(sqlite3_column_int64(statement, index2)),
|
||||
i3: Int(sqlite3_column_int64(statement, index3)),
|
||||
i4: Int(sqlite3_column_int64(statement, index4)),
|
||||
i5: Int(sqlite3_column_int64(statement, index5)),
|
||||
i6: Int(sqlite3_column_int64(statement, index6)),
|
||||
i7: Int(sqlite3_column_int64(statement, index7)),
|
||||
i8: Int(sqlite3_column_int64(statement, index8)),
|
||||
i9: Int(sqlite3_column_int64(statement, index9)))
|
||||
items.append(item)
|
||||
break
|
||||
default:
|
||||
XCTFail()
|
||||
}
|
||||
}
|
||||
|
||||
sqlite3_finalize(statement)
|
||||
|
||||
XCTAssertEqual(items.count, expectedRowCount)
|
||||
XCTAssertEqual(items[0].i0, 0)
|
||||
XCTAssertEqual(items[1].i1, 1)
|
||||
XCTAssertEqual(items[expectedRowCount-1].i9, expectedRowCount-1)
|
||||
}
|
||||
|
||||
sqlite3_close(connection)
|
||||
}
|
||||
|
||||
func testGRDB() throws {
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBPerformanceTests.sqlite")
|
||||
try generateSQLiteDatabaseIfMissing(at: url, insertedRowCount: expectedRowCount)
|
||||
let dbQueue = try DatabaseQueue(path: url.path)
|
||||
|
||||
measure {
|
||||
let items = try! dbQueue.inDatabase { db in
|
||||
try Item.fetchAll(db)
|
||||
}
|
||||
XCTAssertEqual(items.count, expectedRowCount)
|
||||
XCTAssertEqual(items[0].i0, 0)
|
||||
XCTAssertEqual(items[1].i1, 1)
|
||||
XCTAssertEqual(items[expectedRowCount-1].i9, expectedRowCount-1)
|
||||
}
|
||||
}
|
||||
|
||||
#if GRDB_COMPARE
|
||||
func testFMDB() throws {
|
||||
// Here we test the loading of an array of Records.
|
||||
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBPerformanceTests.sqlite")
|
||||
try generateSQLiteDatabaseIfMissing(at: url, insertedRowCount: expectedRowCount)
|
||||
let dbQueue = FMDatabaseQueue(path: url.path)!
|
||||
|
||||
measure {
|
||||
var items = [Item]()
|
||||
dbQueue.inDatabase { db in
|
||||
let rs = try! db.executeQuery("SELECT * FROM item", values: nil)
|
||||
while rs.next() {
|
||||
let dict = rs.resultDictionary!
|
||||
let item = Item(
|
||||
i0: dict["i0"] as! Int,
|
||||
i1: dict["i1"] as! Int,
|
||||
i2: dict["i2"] as! Int,
|
||||
i3: dict["i3"] as! Int,
|
||||
i4: dict["i4"] as! Int,
|
||||
i5: dict["i5"] as! Int,
|
||||
i6: dict["i6"] as! Int,
|
||||
i7: dict["i7"] as! Int,
|
||||
i8: dict["i8"] as! Int,
|
||||
i9: dict["i9"] as! Int)
|
||||
items.append(item)
|
||||
}
|
||||
}
|
||||
XCTAssertEqual(items.count, expectedRowCount)
|
||||
XCTAssertEqual(items[0].i0, 0)
|
||||
XCTAssertEqual(items[1].i1, 1)
|
||||
XCTAssertEqual(items[expectedRowCount-1].i9, expectedRowCount-1)
|
||||
}
|
||||
}
|
||||
|
||||
func testSQLiteSwift() throws {
|
||||
let url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("GRDBPerformanceTests.sqlite")
|
||||
try generateSQLiteDatabaseIfMissing(at: url, insertedRowCount: expectedRowCount)
|
||||
let db = try Connection(url.path)
|
||||
|
||||
measure {
|
||||
var items = [Item]()
|
||||
for row in try! db.prepare(itemTable) {
|
||||
let item = Item(
|
||||
i0: row[i0Column],
|
||||
i1: row[i1Column],
|
||||
i2: row[i2Column],
|
||||
i3: row[i3Column],
|
||||
i4: row[i4Column],
|
||||
i5: row[i5Column],
|
||||
i6: row[i6Column],
|
||||
i7: row[i7Column],
|
||||
i8: row[i8Column],
|
||||
i9: row[i9Column])
|
||||
items.append(item)
|
||||
}
|
||||
XCTAssertEqual(items.count, expectedRowCount)
|
||||
XCTAssertEqual(items[0].i0, 0)
|
||||
XCTAssertEqual(items[1].i1, 1)
|
||||
XCTAssertEqual(items[expectedRowCount-1].i9, expectedRowCount-1)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
-697
@@ -1,697 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 54;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
560C98231C0E23BB00BF8471 /* InsertRecordClassTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BB86121BA9886D001F9168 /* InsertRecordClassTests.swift */; };
|
||||
560C98241C0E23BB00BF8471 /* PerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56CA22211BB41565009A04C5 /* PerformanceTests.swift */; };
|
||||
561C25912439C92D001227F2 /* SQLite in Frameworks */ = {isa = PBXBuildFile; productRef = 561C25902439C92D001227F2 /* SQLite */; };
|
||||
561C25942439C942001227F2 /* FMDB in Frameworks */ = {isa = PBXBuildFile; productRef = 561C25932439C942001227F2 /* FMDB */; };
|
||||
56439B341F4CA1DC0066043F /* InsertRecordClassTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BB86121BA9886D001F9168 /* InsertRecordClassTests.swift */; };
|
||||
56439B361F4CA1DC0066043F /* FetchRecordClassTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DE7B2B1C41311900861EB8 /* FetchRecordClassTests.swift */; };
|
||||
56439B381F4CA1DC0066043F /* FetchNamedValuesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DE7B271C41302500861EB8 /* FetchNamedValuesTests.swift */; };
|
||||
56439B391F4CA1DC0066043F /* InsertPositionalValuesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DE7B231C412F7E00861EB8 /* InsertPositionalValuesTests.swift */; };
|
||||
56439B3C1F4CA1DC0066043F /* PerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56CA22211BB41565009A04C5 /* PerformanceTests.swift */; };
|
||||
56439B3D1F4CA1DC0066043F /* InsertNamedValuesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DE7B251C412FDA00861EB8 /* InsertNamedValuesTests.swift */; };
|
||||
56439B3E1F4CA1DC0066043F /* PerformanceModel.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 56DE7B2D1C42B23B00861EB8 /* PerformanceModel.xcdatamodeld */; };
|
||||
56439B3F1F4CA1DC0066043F /* FetchPositionalValuesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DE7B291C4130AF00861EB8 /* FetchPositionalValuesTests.swift */; };
|
||||
56439B431F4CA1DC0066043F /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 56DE7B341C42B37E00861EB8 /* CoreData.framework */; };
|
||||
565BC5E82517645D00D2B53E /* Generation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 565BC5E72517645D00D2B53E /* Generation.swift */; };
|
||||
565BC5E92517645D00D2B53E /* Generation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 565BC5E72517645D00D2B53E /* Generation.swift */; };
|
||||
56707201208A509C006AD95A /* DateParsingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567071FA208A509C006AD95A /* DateParsingTests.swift */; };
|
||||
5679870223A37A6A0076902D /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 567986B923A378CD0076902D /* GRDB.framework */; };
|
||||
5679870523A37A790076902D /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 567986B923A378CD0076902D /* GRDB.framework */; };
|
||||
5690AFD82120589A001530EA /* InsertRecordEncodableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5690AFD72120589A001530EA /* InsertRecordEncodableTests.swift */; };
|
||||
5690AFD92120589A001530EA /* InsertRecordEncodableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5690AFD72120589A001530EA /* InsertRecordEncodableTests.swift */; };
|
||||
5690AFDB212058CB001530EA /* FetchRecordDecodableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5690AFDA212058CB001530EA /* FetchRecordDecodableTests.swift */; };
|
||||
5690AFDC212058CB001530EA /* FetchRecordDecodableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5690AFDA212058CB001530EA /* FetchRecordDecodableTests.swift */; };
|
||||
56A3FEA827A85F4800B0292E /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = 56A3FEA727A85F4800B0292E /* Realm */; };
|
||||
56A3FEAA27A85F4800B0292E /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 56A3FEA927A85F4800B0292E /* RealmSwift */; };
|
||||
56A6F4AC29BBC8E200E22662 /* ArgumentsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A6F4AB29BBC8E200E22662 /* ArgumentsTests.swift */; };
|
||||
56B6D0E52618BF78003CC455 /* FetchRecordOptimizedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6D0E42618BF78003CC455 /* FetchRecordOptimizedTests.swift */; };
|
||||
56B6D0E62618BF78003CC455 /* FetchRecordOptimizedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6D0E42618BF78003CC455 /* FetchRecordOptimizedTests.swift */; };
|
||||
56B6D0EA2618C00C003CC455 /* InsertRecordOptimizedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6D0E92618C00C003CC455 /* InsertRecordOptimizedTests.swift */; };
|
||||
56B6D0EB2618C00C003CC455 /* InsertRecordOptimizedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B6D0E92618C00C003CC455 /* InsertRecordOptimizedTests.swift */; };
|
||||
56D3BE711F4EB1A00034C6D2 /* FetchRecordStructTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D3BE701F4EB1900034C6D2 /* FetchRecordStructTests.swift */; };
|
||||
56D3BE721F4EB1A00034C6D2 /* FetchRecordStructTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D3BE701F4EB1900034C6D2 /* FetchRecordStructTests.swift */; };
|
||||
56D507831F6D7B2E00AE1C5B /* InsertRecordStructTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D507821F6D7A4500AE1C5B /* InsertRecordStructTests.swift */; };
|
||||
56D507841F6D7B2F00AE1C5B /* InsertRecordStructTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56D507821F6D7A4500AE1C5B /* InsertRecordStructTests.swift */; };
|
||||
56DE7B241C412F7E00861EB8 /* InsertPositionalValuesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DE7B231C412F7E00861EB8 /* InsertPositionalValuesTests.swift */; };
|
||||
56DE7B261C412FDA00861EB8 /* InsertNamedValuesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DE7B251C412FDA00861EB8 /* InsertNamedValuesTests.swift */; };
|
||||
56DE7B281C41302500861EB8 /* FetchNamedValuesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DE7B271C41302500861EB8 /* FetchNamedValuesTests.swift */; };
|
||||
56DE7B2A1C4130AF00861EB8 /* FetchPositionalValuesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DE7B291C4130AF00861EB8 /* FetchPositionalValuesTests.swift */; };
|
||||
56DE7B2C1C41311900861EB8 /* FetchRecordClassTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56DE7B2B1C41311900861EB8 /* FetchRecordClassTests.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
567986B823A378CD0076902D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 567986AD23A378CD0076902D /* GRDB.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = DC3773F319C8CBB3004FCF85;
|
||||
remoteInfo = GRDBOSX;
|
||||
};
|
||||
567986BA23A378CD0076902D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 567986AD23A378CD0076902D /* GRDB.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 56E5D7F91B4D422D00430942;
|
||||
remoteInfo = GRDBOSXTests;
|
||||
};
|
||||
567986FF23A37A590076902D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 567986AD23A378CD0076902D /* GRDB.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = DC3773F219C8CBB3004FCF85;
|
||||
remoteInfo = GRDBOSX;
|
||||
};
|
||||
5679870323A37A710076902D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 567986AD23A378CD0076902D /* GRDB.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = DC3773F219C8CBB3004FCF85;
|
||||
remoteInfo = GRDBOSX;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
56439B4A1F4CA1DC0066043F /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
560C981A1C0E22D300BF8471 /* GRDBOSXPerformanceTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBOSXPerformanceTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
56439B501F4CA1DC0066043F /* GRDBOSXPerformanceComparisonTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBOSXPerformanceComparisonTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
565BC5E72517645D00D2B53E /* Generation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Generation.swift; sourceTree = "<group>"; };
|
||||
567071FA208A509C006AD95A /* DateParsingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DateParsingTests.swift; sourceTree = "<group>"; };
|
||||
567986AD23A378CD0076902D /* GRDB.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GRDB.xcodeproj; path = ../../../GRDB.xcodeproj; sourceTree = "<group>"; };
|
||||
5690AFD72120589A001530EA /* InsertRecordEncodableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InsertRecordEncodableTests.swift; sourceTree = "<group>"; };
|
||||
5690AFDA212058CB001530EA /* FetchRecordDecodableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchRecordDecodableTests.swift; sourceTree = "<group>"; };
|
||||
56A6F4AB29BBC8E200E22662 /* ArgumentsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArgumentsTests.swift; sourceTree = "<group>"; };
|
||||
56B6D0E42618BF78003CC455 /* FetchRecordOptimizedTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchRecordOptimizedTests.swift; sourceTree = "<group>"; };
|
||||
56B6D0E92618C00C003CC455 /* InsertRecordOptimizedTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InsertRecordOptimizedTests.swift; sourceTree = "<group>"; };
|
||||
56BB86121BA9886D001F9168 /* InsertRecordClassTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InsertRecordClassTests.swift; sourceTree = "<group>"; };
|
||||
56BB862D1BA98933001F9168 /* GRDBPerformanceComparisonTests-Bridging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GRDBPerformanceComparisonTests-Bridging.h"; sourceTree = "<group>"; };
|
||||
56CA22211BB41565009A04C5 /* PerformanceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PerformanceTests.swift; sourceTree = "<group>"; };
|
||||
56D3BE701F4EB1900034C6D2 /* FetchRecordStructTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchRecordStructTests.swift; sourceTree = "<group>"; };
|
||||
56D507821F6D7A4500AE1C5B /* InsertRecordStructTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InsertRecordStructTests.swift; sourceTree = "<group>"; };
|
||||
56DE7B231C412F7E00861EB8 /* InsertPositionalValuesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InsertPositionalValuesTests.swift; sourceTree = "<group>"; };
|
||||
56DE7B251C412FDA00861EB8 /* InsertNamedValuesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InsertNamedValuesTests.swift; sourceTree = "<group>"; };
|
||||
56DE7B271C41302500861EB8 /* FetchNamedValuesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchNamedValuesTests.swift; sourceTree = "<group>"; };
|
||||
56DE7B291C4130AF00861EB8 /* FetchPositionalValuesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchPositionalValuesTests.swift; sourceTree = "<group>"; };
|
||||
56DE7B2B1C41311900861EB8 /* FetchRecordClassTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchRecordClassTests.swift; sourceTree = "<group>"; };
|
||||
56DE7B2E1C42B23B00861EB8 /* PerformanceModel.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = PerformanceModel.xcdatamodel; sourceTree = "<group>"; };
|
||||
56DE7B341C42B37E00861EB8 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
|
||||
DC37740419C8CBB3004FCF85 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
560C98111C0E22D300BF8471 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5679870223A37A6A0076902D /* GRDB.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
56439B401F4CA1DC0066043F /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
56A3FEAA27A85F4800B0292E /* RealmSwift in Frameworks */,
|
||||
561C25912439C92D001227F2 /* SQLite in Frameworks */,
|
||||
561C25942439C942001227F2 /* FMDB in Frameworks */,
|
||||
5679870523A37A790076902D /* GRDB.framework in Frameworks */,
|
||||
56439B431F4CA1DC0066043F /* CoreData.framework in Frameworks */,
|
||||
56A3FEA827A85F4800B0292E /* Realm in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
567986AE23A378CD0076902D /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
567986B923A378CD0076902D /* GRDB.framework */,
|
||||
567986BB23A378CD0076902D /* GRDBTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5679870123A37A6A0076902D /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
56BB86101BA9886D001F9168 /* Performance */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56BB862D1BA98933001F9168 /* GRDBPerformanceComparisonTests-Bridging.h */,
|
||||
56DE7B2D1C42B23B00861EB8 /* PerformanceModel.xcdatamodeld */,
|
||||
56A6F4AB29BBC8E200E22662 /* ArgumentsTests.swift */,
|
||||
567071FA208A509C006AD95A /* DateParsingTests.swift */,
|
||||
56DE7B271C41302500861EB8 /* FetchNamedValuesTests.swift */,
|
||||
56DE7B291C4130AF00861EB8 /* FetchPositionalValuesTests.swift */,
|
||||
56DE7B2B1C41311900861EB8 /* FetchRecordClassTests.swift */,
|
||||
5690AFDA212058CB001530EA /* FetchRecordDecodableTests.swift */,
|
||||
56B6D0E42618BF78003CC455 /* FetchRecordOptimizedTests.swift */,
|
||||
56D3BE701F4EB1900034C6D2 /* FetchRecordStructTests.swift */,
|
||||
565BC5E72517645D00D2B53E /* Generation.swift */,
|
||||
56DE7B251C412FDA00861EB8 /* InsertNamedValuesTests.swift */,
|
||||
56DE7B231C412F7E00861EB8 /* InsertPositionalValuesTests.swift */,
|
||||
56BB86121BA9886D001F9168 /* InsertRecordClassTests.swift */,
|
||||
5690AFD72120589A001530EA /* InsertRecordEncodableTests.swift */,
|
||||
56B6D0E92618C00C003CC455 /* InsertRecordOptimizedTests.swift */,
|
||||
56D507821F6D7A4500AE1C5B /* InsertRecordStructTests.swift */,
|
||||
56CA22211BB41565009A04C5 /* PerformanceTests.swift */,
|
||||
56DE7B341C42B37E00861EB8 /* CoreData.framework */,
|
||||
);
|
||||
name = Performance;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
DC3773E919C8CBB3004FCF85 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
567986AD23A378CD0076902D /* GRDB.xcodeproj */,
|
||||
56BB86101BA9886D001F9168 /* Performance */,
|
||||
DC37740319C8CBB3004FCF85 /* Supporting Files */,
|
||||
DC3773F419C8CBB3004FCF85 /* Products */,
|
||||
5679870123A37A6A0076902D /* Frameworks */,
|
||||
);
|
||||
indentWidth = 4;
|
||||
sourceTree = "<group>";
|
||||
tabWidth = 4;
|
||||
usesTabs = 0;
|
||||
};
|
||||
DC3773F419C8CBB3004FCF85 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
560C981A1C0E22D300BF8471 /* GRDBOSXPerformanceTests.xctest */,
|
||||
56439B501F4CA1DC0066043F /* GRDBOSXPerformanceComparisonTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
DC37740319C8CBB3004FCF85 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DC37740419C8CBB3004FCF85 /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
560C97CF1C0E22D300BF8471 /* GRDBOSXPerformanceTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 560C98171C0E22D300BF8471 /* Build configuration list for PBXNativeTarget "GRDBOSXPerformanceTests" */;
|
||||
buildPhases = (
|
||||
560C97D41C0E22D300BF8471 /* Sources */,
|
||||
560C98111C0E22D300BF8471 /* Frameworks */,
|
||||
560C98151C0E22D300BF8471 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
5679870023A37A590076902D /* PBXTargetDependency */,
|
||||
);
|
||||
name = GRDBOSXPerformanceTests;
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = GRDBOSXTests;
|
||||
productReference = 560C981A1C0E22D300BF8471 /* GRDBOSXPerformanceTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
56439B2D1F4CA1DC0066043F /* GRDBOSXPerformanceComparisonTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 56439B4D1F4CA1DC0066043F /* Build configuration list for PBXNativeTarget "GRDBOSXPerformanceComparisonTests" */;
|
||||
buildPhases = (
|
||||
56439B321F4CA1DC0066043F /* Sources */,
|
||||
56439B401F4CA1DC0066043F /* Frameworks */,
|
||||
56439B461F4CA1DC0066043F /* Resources */,
|
||||
56439B4A1F4CA1DC0066043F /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
5679870423A37A710076902D /* PBXTargetDependency */,
|
||||
);
|
||||
name = GRDBOSXPerformanceComparisonTests;
|
||||
packageProductDependencies = (
|
||||
561C25902439C92D001227F2 /* SQLite */,
|
||||
561C25932439C942001227F2 /* FMDB */,
|
||||
56A3FEA727A85F4800B0292E /* Realm */,
|
||||
56A3FEA927A85F4800B0292E /* RealmSwift */,
|
||||
);
|
||||
productName = GRDBOSXTests;
|
||||
productReference = 56439B501F4CA1DC0066043F /* GRDBOSXPerformanceComparisonTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
DC3773EA19C8CBB3004FCF85 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0730;
|
||||
LastUpgradeCheck = 1200;
|
||||
ORGANIZATIONNAME = "Gwendal Roué";
|
||||
};
|
||||
buildConfigurationList = DC3773ED19C8CBB3004FCF85 /* Build configuration list for PBXProject "GRDBPerformance" */;
|
||||
compatibilityVersion = "Xcode 6.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = DC3773E919C8CBB3004FCF85;
|
||||
packageReferences = (
|
||||
561C258F2439C92D001227F2 /* XCRemoteSwiftPackageReference "SQLite.swift" */,
|
||||
561C25922439C942001227F2 /* XCRemoteSwiftPackageReference "fmdb" */,
|
||||
56A3FEA627A85F4800B0292E /* XCRemoteSwiftPackageReference "realm-swift" */,
|
||||
);
|
||||
productRefGroup = DC3773F419C8CBB3004FCF85 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
{
|
||||
ProductGroup = 567986AE23A378CD0076902D /* Products */;
|
||||
ProjectRef = 567986AD23A378CD0076902D /* GRDB.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
560C97CF1C0E22D300BF8471 /* GRDBOSXPerformanceTests */,
|
||||
56439B2D1F4CA1DC0066043F /* GRDBOSXPerformanceComparisonTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
567986B923A378CD0076902D /* GRDB.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = GRDB.framework;
|
||||
remoteRef = 567986B823A378CD0076902D /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
567986BB23A378CD0076902D /* GRDBTests.xctest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = GRDBTests.xctest;
|
||||
remoteRef = 567986BA23A378CD0076902D /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
560C98151C0E22D300BF8471 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
56439B461F4CA1DC0066043F /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
560C97D41C0E22D300BF8471 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
56D3BE711F4EB1A00034C6D2 /* FetchRecordStructTests.swift in Sources */,
|
||||
565BC5E82517645D00D2B53E /* Generation.swift in Sources */,
|
||||
560C98231C0E23BB00BF8471 /* InsertRecordClassTests.swift in Sources */,
|
||||
56707201208A509C006AD95A /* DateParsingTests.swift in Sources */,
|
||||
56DE7B2C1C41311900861EB8 /* FetchRecordClassTests.swift in Sources */,
|
||||
56DE7B281C41302500861EB8 /* FetchNamedValuesTests.swift in Sources */,
|
||||
5690AFD82120589A001530EA /* InsertRecordEncodableTests.swift in Sources */,
|
||||
56B6D0EA2618C00C003CC455 /* InsertRecordOptimizedTests.swift in Sources */,
|
||||
56A6F4AC29BBC8E200E22662 /* ArgumentsTests.swift in Sources */,
|
||||
5690AFDB212058CB001530EA /* FetchRecordDecodableTests.swift in Sources */,
|
||||
56D507831F6D7B2E00AE1C5B /* InsertRecordStructTests.swift in Sources */,
|
||||
56DE7B241C412F7E00861EB8 /* InsertPositionalValuesTests.swift in Sources */,
|
||||
560C98241C0E23BB00BF8471 /* PerformanceTests.swift in Sources */,
|
||||
56B6D0E52618BF78003CC455 /* FetchRecordOptimizedTests.swift in Sources */,
|
||||
56DE7B261C412FDA00861EB8 /* InsertNamedValuesTests.swift in Sources */,
|
||||
56DE7B2A1C4130AF00861EB8 /* FetchPositionalValuesTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
56439B321F4CA1DC0066043F /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
56439B341F4CA1DC0066043F /* InsertRecordClassTests.swift in Sources */,
|
||||
565BC5E92517645D00D2B53E /* Generation.swift in Sources */,
|
||||
56439B361F4CA1DC0066043F /* FetchRecordClassTests.swift in Sources */,
|
||||
56439B381F4CA1DC0066043F /* FetchNamedValuesTests.swift in Sources */,
|
||||
56439B391F4CA1DC0066043F /* InsertPositionalValuesTests.swift in Sources */,
|
||||
56D507841F6D7B2F00AE1C5B /* InsertRecordStructTests.swift in Sources */,
|
||||
5690AFD92120589A001530EA /* InsertRecordEncodableTests.swift in Sources */,
|
||||
56B6D0EB2618C00C003CC455 /* InsertRecordOptimizedTests.swift in Sources */,
|
||||
56439B3C1F4CA1DC0066043F /* PerformanceTests.swift in Sources */,
|
||||
56D3BE721F4EB1A00034C6D2 /* FetchRecordStructTests.swift in Sources */,
|
||||
56439B3D1F4CA1DC0066043F /* InsertNamedValuesTests.swift in Sources */,
|
||||
56439B3E1F4CA1DC0066043F /* PerformanceModel.xcdatamodeld in Sources */,
|
||||
56B6D0E62618BF78003CC455 /* FetchRecordOptimizedTests.swift in Sources */,
|
||||
5690AFDC212058CB001530EA /* FetchRecordDecodableTests.swift in Sources */,
|
||||
56439B3F1F4CA1DC0066043F /* FetchPositionalValuesTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
5679870023A37A590076902D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = GRDBOSX;
|
||||
targetProxy = 567986FF23A37A590076902D /* PBXContainerItemProxy */;
|
||||
};
|
||||
5679870423A37A710076902D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = GRDBOSX;
|
||||
targetProxy = 5679870323A37A710076902D /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
560C98181C0E22D300BF8471 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
560C98191C0E22D300BF8471 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
FRAMEWORK_SEARCH_PATHS = "";
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
56439B4E1F4CA1DC0066043F /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) -D GRDB_COMPARE";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "GRDBPerformanceComparisonTests-Bridging.h";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
56439B4F1F4CA1DC0066043F /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) -D GRDB_COMPARE";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBOSXTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "GRDBPerformanceComparisonTests-Bridging.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
DC37740719C8CBB3004FCF85 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
DC37740819C8CBB3004FCF85 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
560C98171C0E22D300BF8471 /* Build configuration list for PBXNativeTarget "GRDBOSXPerformanceTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
560C98181C0E22D300BF8471 /* Debug */,
|
||||
560C98191C0E22D300BF8471 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
56439B4D1F4CA1DC0066043F /* Build configuration list for PBXNativeTarget "GRDBOSXPerformanceComparisonTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
56439B4E1F4CA1DC0066043F /* Debug */,
|
||||
56439B4F1F4CA1DC0066043F /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
DC3773ED19C8CBB3004FCF85 /* Build configuration list for PBXProject "GRDBPerformance" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
DC37740719C8CBB3004FCF85 /* Debug */,
|
||||
DC37740819C8CBB3004FCF85 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCRemoteSwiftPackageReference section */
|
||||
561C258F2439C92D001227F2 /* XCRemoteSwiftPackageReference "SQLite.swift" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/stephencelis/SQLite.swift.git";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 0.12.2;
|
||||
};
|
||||
};
|
||||
561C25922439C942001227F2 /* XCRemoteSwiftPackageReference "fmdb" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/ccgus/fmdb.git";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 2.7.0;
|
||||
};
|
||||
};
|
||||
56A3FEA627A85F4800B0292E /* XCRemoteSwiftPackageReference "realm-swift" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/realm/realm-swift.git";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 10.22.0;
|
||||
};
|
||||
};
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
561C25902439C92D001227F2 /* SQLite */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 561C258F2439C92D001227F2 /* XCRemoteSwiftPackageReference "SQLite.swift" */;
|
||||
productName = SQLite;
|
||||
};
|
||||
561C25932439C942001227F2 /* FMDB */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 561C25922439C942001227F2 /* XCRemoteSwiftPackageReference "fmdb" */;
|
||||
productName = FMDB;
|
||||
};
|
||||
56A3FEA727A85F4800B0292E /* Realm */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 56A3FEA627A85F4800B0292E /* XCRemoteSwiftPackageReference "realm-swift" */;
|
||||
productName = Realm;
|
||||
};
|
||||
56A3FEA927A85F4800B0292E /* RealmSwift */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 56A3FEA627A85F4800B0292E /* XCRemoteSwiftPackageReference "realm-swift" */;
|
||||
productName = RealmSwift;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
|
||||
/* Begin XCVersionGroup section */
|
||||
56DE7B2D1C42B23B00861EB8 /* PerformanceModel.xcdatamodeld */ = {
|
||||
isa = XCVersionGroup;
|
||||
children = (
|
||||
56DE7B2E1C42B23B00861EB8 /* PerformanceModel.xcdatamodel */,
|
||||
);
|
||||
currentVersion = 56DE7B2E1C42B23B00861EB8 /* PerformanceModel.xcdatamodel */;
|
||||
path = PerformanceModel.xcdatamodeld;
|
||||
sourceTree = "<group>";
|
||||
versionGroupType = wrapper.xcdatamodel;
|
||||
};
|
||||
/* End XCVersionGroup section */
|
||||
};
|
||||
rootObject = DC3773EA19C8CBB3004FCF85 /* Project object */;
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"originHash" : "8d182a38fc35b0d50c198e0cbd39dc7fa5922eae5336ff3b0c73c2d51bcba752",
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "fmdb",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/ccgus/fmdb.git",
|
||||
"state" : {
|
||||
"revision" : "47a2fa12a242b5a2fe13b916c22f2212e426055c",
|
||||
"version" : "2.7.9"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "realm-core",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/realm/realm-core.git",
|
||||
"state" : {
|
||||
"revision" : "374dd672af357732dccc135fecc905406fec3223",
|
||||
"version" : "14.4.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "realm-swift",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/realm/realm-swift.git",
|
||||
"state" : {
|
||||
"revision" : "e0c2fbb442979fbf1e4be80e01d142f310a9c762",
|
||||
"version" : "10.49.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "sqlite.swift",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/stephencelis/SQLite.swift.git",
|
||||
"state" : {
|
||||
"revision" : "e78ae0220e17525a15ac68c697a155eb7a672a8e",
|
||||
"version" : "0.15.0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"version" : 3
|
||||
}
|
||||
-78
@@ -1,78 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1200"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "56439B2D1F4CA1DC0066043F"
|
||||
BuildableName = "GRDBOSXPerformanceComparisonTests.xctest"
|
||||
BlueprintName = "GRDBOSXPerformanceComparisonTests"
|
||||
ReferencedContainer = "container:GRDBPerformance.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
disableMainThreadChecker = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "56439B2D1F4CA1DC0066043F"
|
||||
BuildableName = "GRDBOSXPerformanceComparisonTests.xctest"
|
||||
BlueprintName = "GRDBOSXPerformanceComparisonTests"
|
||||
ReferencedContainer = "container:GRDBPerformance.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "56439B2D1F4CA1DC0066043F"
|
||||
BuildableName = "GRDBOSXPerformanceComparisonTests.xctest"
|
||||
BlueprintName = "GRDBOSXPerformanceComparisonTests"
|
||||
ReferencedContainer = "container:GRDBPerformance.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
-78
@@ -1,78 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1200"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "560C97CF1C0E22D300BF8471"
|
||||
BuildableName = "GRDBOSXPerformanceTests.xctest"
|
||||
BlueprintName = "GRDBOSXPerformanceTests"
|
||||
ReferencedContainer = "container:GRDBPerformance.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
disableMainThreadChecker = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "560C97CF1C0E22D300BF8471"
|
||||
BuildableName = "GRDBOSXPerformanceTests.xctest"
|
||||
BlueprintName = "GRDBOSXPerformanceTests"
|
||||
ReferencedContainer = "container:GRDBPerformance.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "560C97CF1C0E22D300BF8471"
|
||||
BuildableName = "GRDBOSXPerformanceTests.xctest"
|
||||
BlueprintName = "GRDBOSXPerformanceTests"
|
||||
ReferencedContainer = "container:GRDBPerformance.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
-1
@@ -1 +0,0 @@
|
||||
#import "FMDB.h"
|
||||
@@ -1,72 +0,0 @@
|
||||
import XCTest
|
||||
import Foundation
|
||||
import GRDB
|
||||
#if GRDB_COMPARE
|
||||
import CoreData
|
||||
import RealmSwift
|
||||
#endif
|
||||
|
||||
func generateSQLiteDatabaseIfMissing(at url: URL, insertedRowCount: Int) throws {
|
||||
try DatabaseQueue(path: url.path).write { db in
|
||||
if try db.tableExists("item") {
|
||||
let count = try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM item")!
|
||||
if count == insertedRowCount {
|
||||
return
|
||||
} else {
|
||||
try db.execute(sql: "DROP TABLE item")
|
||||
}
|
||||
}
|
||||
try db.execute(sql: "CREATE TABLE item (i0 INT, i1 INT, i2 INT, i3 INT, i4 INT, i5 INT, i6 INT, i7 INT, i8 INT, i9 INT)")
|
||||
|
||||
let statement = try! db.makeStatement(sql: "INSERT INTO item (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) VALUES (?,?,?,?,?,?,?,?,?,?)")
|
||||
for i in 0..<insertedRowCount {
|
||||
try statement.execute(arguments: [i, i, i, i, i, i, i, i, i, i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if GRDB_COMPARE
|
||||
func generateCoreDataDatabaseIfMissing(at url: URL, fromModelAt modelURL: URL, insertedRowCount: Int) throws {
|
||||
let mom = NSManagedObjectModel(contentsOf: modelURL)!
|
||||
let psc = NSPersistentStoreCoordinator(managedObjectModel: mom)
|
||||
try psc.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: url, options: nil)
|
||||
let moc = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
|
||||
moc.performAndWait {
|
||||
moc.persistentStoreCoordinator = psc
|
||||
let request = NSFetchRequest<NSFetchRequestResult>(entityName: "Item")
|
||||
if try! moc.count(for: request) == insertedRowCount {
|
||||
return
|
||||
}
|
||||
try! moc.execute(NSBatchDeleteRequest(fetchRequest: request))
|
||||
|
||||
for i in 0..<insertedRowCount {
|
||||
let item = NSEntityDescription.insertNewObject(forEntityName: "Item", into: moc)
|
||||
item.setValue(NSNumber(value: i), forKey: "i0")
|
||||
item.setValue(NSNumber(value: i), forKey: "i1")
|
||||
item.setValue(NSNumber(value: i), forKey: "i2")
|
||||
item.setValue(NSNumber(value: i), forKey: "i3")
|
||||
item.setValue(NSNumber(value: i), forKey: "i4")
|
||||
item.setValue(NSNumber(value: i), forKey: "i5")
|
||||
item.setValue(NSNumber(value: i), forKey: "i6")
|
||||
item.setValue(NSNumber(value: i), forKey: "i7")
|
||||
item.setValue(NSNumber(value: i), forKey: "i8")
|
||||
item.setValue(NSNumber(value: i), forKey: "i9")
|
||||
}
|
||||
try! moc.save()
|
||||
}
|
||||
}
|
||||
|
||||
func generateRealmDatabaseIfMissing(at url: URL, insertedRowCount: Int) throws {
|
||||
let realm = try Realm(fileURL: url)
|
||||
try realm.write {
|
||||
if realm.objects(RealmItem.self).count == insertedRowCount {
|
||||
return
|
||||
}
|
||||
|
||||
realm.deleteAll()
|
||||
for i in 0..<insertedRowCount {
|
||||
realm.add(RealmItem(i0: i, i1: i, i2: i, i3: i, i4: i, i5: i, i6: i, i7: i, i8: i, i9: i))
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>3.6.1</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
-122
@@ -1,122 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
#if GRDB_COMPARE
|
||||
import SQLite
|
||||
#endif
|
||||
|
||||
private let insertedRowCount = 50_000
|
||||
|
||||
// Here we insert rows, referencing statement arguments by name.
|
||||
class InsertNamedValuesTests: XCTestCase {
|
||||
|
||||
func testGRDB() {
|
||||
let databaseFileName = "GRDBPerformanceTests-\(ProcessInfo.processInfo.globallyUniqueString).sqlite"
|
||||
let databasePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(databaseFileName)
|
||||
defer {
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM item")!, insertedRowCount)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MIN(i0) FROM item")!, 0)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MAX(i9) FROM item")!, insertedRowCount - 1)
|
||||
}
|
||||
try! FileManager.default.removeItem(atPath: databasePath)
|
||||
}
|
||||
|
||||
measure {
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
try db.execute(sql: "CREATE TABLE item (i0 INT, i1 INT, i2 INT, i3 INT, i4 INT, i5 INT, i6 INT, i7 INT, i8 INT, i9 INT)")
|
||||
}
|
||||
|
||||
try! dbQueue.inTransaction { db in
|
||||
let statement = try! db.makeStatement(sql: "INSERT INTO item (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) VALUES (:i0, :i1, :i2, :i3, :i4, :i5, :i6, :i7, :i8, :i9)")
|
||||
for i in 0..<insertedRowCount {
|
||||
try statement.execute(arguments: ["i0": i, "i1": i, "i2": i, "i3": i, "i4": i, "i5": i, "i6": i, "i7": i, "i8": i, "i9": i])
|
||||
}
|
||||
return .commit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if GRDB_COMPARE
|
||||
func testFMDB() {
|
||||
let databaseFileName = "GRDBPerformanceTests-\(ProcessInfo.processInfo.globallyUniqueString).sqlite"
|
||||
let databasePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(databaseFileName)
|
||||
defer {
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM item")!, insertedRowCount)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MIN(i0) FROM item")!, 0)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MAX(i9) FROM item")!, insertedRowCount - 1)
|
||||
}
|
||||
try! FileManager.default.removeItem(atPath: databasePath)
|
||||
}
|
||||
|
||||
measure {
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
|
||||
let dbQueue = FMDatabaseQueue(path: databasePath)!
|
||||
dbQueue.inDatabase { db in
|
||||
db.executeStatements("CREATE TABLE item (i0 INT, i1 INT, i2 INT, i3 INT, i4 INT, i5 INT, i6 INT, i7 INT, i8 INT, i9 INT)")
|
||||
}
|
||||
|
||||
dbQueue.inTransaction { (db, rollback) -> Void in
|
||||
db.shouldCacheStatements = true
|
||||
for i in 0..<insertedRowCount {
|
||||
db.executeUpdate("INSERT INTO item (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) VALUES (:i0, :i1, :i2, :i3, :i4, :i5, :i6, :i7, :i8, :i9)", withParameterDictionary: ["i0": i, "i1": i, "i2": i, "i3": i, "i4": i, "i5": i, "i6": i, "i7": i, "i8": i, "i9": i])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testSQLiteSwift() {
|
||||
let databaseFileName = "GRDBPerformanceTests-\(ProcessInfo.processInfo.globallyUniqueString).sqlite"
|
||||
let databasePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(databaseFileName)
|
||||
defer {
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM item")!, insertedRowCount)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MIN(i0) FROM item")!, 0)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MAX(i9) FROM item")!, insertedRowCount - 1)
|
||||
}
|
||||
try! FileManager.default.removeItem(atPath: databasePath)
|
||||
}
|
||||
|
||||
measure {
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
|
||||
let db = try! Connection(databasePath)
|
||||
try! db.run(itemTable.create { t in
|
||||
t.column(i0Column)
|
||||
t.column(i1Column)
|
||||
t.column(i2Column)
|
||||
t.column(i3Column)
|
||||
t.column(i4Column)
|
||||
t.column(i5Column)
|
||||
t.column(i6Column)
|
||||
t.column(i7Column)
|
||||
t.column(i8Column)
|
||||
t.column(i9Column)
|
||||
})
|
||||
|
||||
try! db.transaction {
|
||||
for i in 0..<insertedRowCount {
|
||||
_ = try db.run(itemTable.insert(
|
||||
i0Column <- i,
|
||||
i1Column <- i,
|
||||
i2Column <- i,
|
||||
i3Column <- i,
|
||||
i4Column <- i,
|
||||
i5Column <- i,
|
||||
i6Column <- i,
|
||||
i7Column <- i,
|
||||
i8Column <- i,
|
||||
i9Column <- i))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
-161
@@ -1,161 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
#if GRDB_COMPARE
|
||||
import SQLite
|
||||
#endif
|
||||
|
||||
private let insertedRowCount = 50_000
|
||||
|
||||
// Here we insert rows, referencing statement arguments by index.
|
||||
class InsertPositionalValuesTests: XCTestCase {
|
||||
|
||||
func testSQLite() {
|
||||
let databaseFileName = "GRDBPerformanceTests-\(ProcessInfo.processInfo.globallyUniqueString).sqlite"
|
||||
let databasePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(databaseFileName)
|
||||
defer {
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM item")!, insertedRowCount)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MIN(i0) FROM item")!, 0)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MAX(i9) FROM item")!, insertedRowCount - 1)
|
||||
}
|
||||
try! FileManager.default.removeItem(atPath: databasePath)
|
||||
}
|
||||
|
||||
let options = XCTMeasureOptions()
|
||||
options.iterationCount = 50
|
||||
measure(options: options) {
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
|
||||
var connection: OpaquePointer? = nil
|
||||
sqlite3_open_v2(databasePath, &connection, 0x00000004 /*SQLITE_OPEN_CREATE*/ | 0x00000002 /*SQLITE_OPEN_READWRITE*/, nil)
|
||||
sqlite3_exec(connection, "CREATE TABLE item (i0 INT, i1 INT, i2 INT, i3 INT, i4 INT, i5 INT, i6 INT, i7 INT, i8 INT, i9 INT)", nil, nil, nil)
|
||||
|
||||
sqlite3_exec(connection, "BEGIN TRANSACTION", nil, nil, nil)
|
||||
|
||||
var statement: OpaquePointer? = nil
|
||||
sqlite3_prepare_v2(connection, "INSERT INTO item (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) VALUES (?,?,?,?,?,?,?,?,?,?)", -1, &statement, nil)
|
||||
|
||||
for i in Int64(0)..<Int64(insertedRowCount) {
|
||||
sqlite3_reset(statement)
|
||||
sqlite3_bind_int64(statement, 1, i)
|
||||
sqlite3_bind_int64(statement, 2, i)
|
||||
sqlite3_bind_int64(statement, 3, i)
|
||||
sqlite3_bind_int64(statement, 4, i)
|
||||
sqlite3_bind_int64(statement, 5, i)
|
||||
sqlite3_bind_int64(statement, 6, i)
|
||||
sqlite3_bind_int64(statement, 7, i)
|
||||
sqlite3_bind_int64(statement, 8, i)
|
||||
sqlite3_bind_int64(statement, 9, i)
|
||||
sqlite3_bind_int64(statement, 10, i)
|
||||
sqlite3_step(statement)
|
||||
}
|
||||
|
||||
sqlite3_finalize(statement)
|
||||
sqlite3_exec(connection, "COMMIT", nil, nil, nil)
|
||||
sqlite3_close(connection)
|
||||
}
|
||||
}
|
||||
|
||||
func testGRDB() {
|
||||
let databaseFileName = "GRDBPerformanceTests-\(ProcessInfo.processInfo.globallyUniqueString).sqlite"
|
||||
let databasePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(databaseFileName)
|
||||
defer {
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM item")!, insertedRowCount)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MIN(i0) FROM item")!, 0)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MAX(i9) FROM item")!, insertedRowCount - 1)
|
||||
}
|
||||
try! FileManager.default.removeItem(atPath: databasePath)
|
||||
}
|
||||
let options = XCTMeasureOptions()
|
||||
options.iterationCount = 50
|
||||
measure(options: options) {
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
try db.execute(sql: "CREATE TABLE item (i0 INT, i1 INT, i2 INT, i3 INT, i4 INT, i5 INT, i6 INT, i7 INT, i8 INT, i9 INT)")
|
||||
}
|
||||
|
||||
try! dbQueue.inTransaction { db in
|
||||
let statement = try! db.makeStatement(sql: "INSERT INTO item (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) VALUES (?,?,?,?,?,?,?,?,?,?)")
|
||||
for i in 0..<insertedRowCount {
|
||||
statement.setUncheckedArguments([i, i, i, i, i, i, i, i, i, i])
|
||||
try statement.execute()
|
||||
}
|
||||
return .commit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if GRDB_COMPARE
|
||||
func testFMDB() {
|
||||
let databaseFileName = "GRDBPerformanceTests-\(ProcessInfo.processInfo.globallyUniqueString).sqlite"
|
||||
let databasePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(databaseFileName)
|
||||
defer {
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM item")!, insertedRowCount)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MIN(i0) FROM item")!, 0)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MAX(i9) FROM item")!, insertedRowCount - 1)
|
||||
}
|
||||
try! FileManager.default.removeItem(atPath: databasePath)
|
||||
}
|
||||
measure {
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
|
||||
let dbQueue = FMDatabaseQueue(path: databasePath)!
|
||||
dbQueue.inDatabase { db in
|
||||
db.executeStatements("CREATE TABLE item (i0 INT, i1 INT, i2 INT, i3 INT, i4 INT, i5 INT, i6 INT, i7 INT, i8 INT, i9 INT)")
|
||||
}
|
||||
|
||||
dbQueue.inTransaction { (db, rollback) -> Void in
|
||||
db.shouldCacheStatements = true
|
||||
for i in 0..<insertedRowCount {
|
||||
db.executeUpdate("INSERT INTO item (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) VALUES (?,?,?,?,?,?,?,?,?,?)", withArgumentsIn: [i, i, i, i, i, i, i, i, i, i])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testSQLiteSwift() {
|
||||
let databaseFileName = "GRDBPerformanceTests-\(ProcessInfo.processInfo.globallyUniqueString).sqlite"
|
||||
let databasePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(databaseFileName)
|
||||
defer {
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM item")!, insertedRowCount)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MIN(i0) FROM item")!, 0)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MAX(i9) FROM item")!, insertedRowCount - 1)
|
||||
}
|
||||
try! FileManager.default.removeItem(atPath: databasePath)
|
||||
}
|
||||
measure {
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
|
||||
let db = try! Connection(databasePath)
|
||||
try! db.run(itemTable.create { t in
|
||||
t.column(i0Column)
|
||||
t.column(i1Column)
|
||||
t.column(i2Column)
|
||||
t.column(i3Column)
|
||||
t.column(i4Column)
|
||||
t.column(i5Column)
|
||||
t.column(i6Column)
|
||||
t.column(i7Column)
|
||||
t.column(i8Column)
|
||||
t.column(i9Column)
|
||||
})
|
||||
|
||||
try! db.transaction {
|
||||
let stmt = try! db.prepare("INSERT INTO item (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) VALUES (?,?,?,?,?,?,?,?,?,?)")
|
||||
for i in 0..<insertedRowCount {
|
||||
try stmt.run(i, i, i, i, i, i, i, i, i, i)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
-141
@@ -1,141 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
#if GRDB_COMPARE
|
||||
import CoreData
|
||||
import RealmSwift
|
||||
#endif
|
||||
|
||||
private let insertedRowCount = 50_000
|
||||
|
||||
// Here we insert record classes.
|
||||
class InsertRecordClassTests: XCTestCase {
|
||||
|
||||
func testGRDB() {
|
||||
class Item: Record {
|
||||
var i0: Int
|
||||
var i1: Int
|
||||
var i2: Int
|
||||
var i3: Int
|
||||
var i4: Int
|
||||
var i5: Int
|
||||
var i6: Int
|
||||
var i7: Int
|
||||
var i8: Int
|
||||
var i9: Int
|
||||
|
||||
override class var databaseTableName: String {
|
||||
"item"
|
||||
}
|
||||
|
||||
init(i0: Int, i1: Int, i2: Int, i3: Int, i4: Int, i5: Int, i6: Int, i7: Int, i8: Int, i9: Int) {
|
||||
self.i0 = i0
|
||||
self.i1 = i1
|
||||
self.i2 = i2
|
||||
self.i3 = i3
|
||||
self.i4 = i4
|
||||
self.i5 = i5
|
||||
self.i6 = i6
|
||||
self.i7 = i7
|
||||
self.i8 = i8
|
||||
self.i9 = i9
|
||||
super.init()
|
||||
}
|
||||
|
||||
required init(row: Row) {
|
||||
fatalError("init(row:) has not been implemented")
|
||||
}
|
||||
|
||||
override func encode(to container: inout PersistenceContainer) throws {
|
||||
container["i0"] = i0
|
||||
container["i1"] = i1
|
||||
container["i2"] = i2
|
||||
container["i3"] = i3
|
||||
container["i4"] = i4
|
||||
container["i5"] = i5
|
||||
container["i6"] = i6
|
||||
container["i7"] = i7
|
||||
container["i8"] = i8
|
||||
container["i9"] = i9
|
||||
}
|
||||
}
|
||||
|
||||
let databaseFileName = "GRDBPerformanceTests-\(ProcessInfo.processInfo.globallyUniqueString).sqlite"
|
||||
let databasePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(databaseFileName)
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
defer {
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM item")!, insertedRowCount)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MIN(i0) FROM item")!, 0)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MAX(i9) FROM item")!, insertedRowCount - 1)
|
||||
}
|
||||
try! FileManager.default.removeItem(atPath: databasePath)
|
||||
}
|
||||
|
||||
measure {
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
try db.execute(sql: "CREATE TABLE item (i0 INT, i1 INT, i2 INT, i3 INT, i4 INT, i5 INT, i6 INT, i7 INT, i8 INT, i9 INT)")
|
||||
}
|
||||
|
||||
try! dbQueue.inTransaction { db in
|
||||
for i in 0..<insertedRowCount {
|
||||
try Item(i0: i, i1: i, i2: i, i3: i, i4: i, i5: i, i6: i, i7: i, i8: i, i9: i).insert(db)
|
||||
}
|
||||
return .commit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if GRDB_COMPARE
|
||||
func testCoreData() {
|
||||
let databaseFileName = "GRDBPerformanceTests-\(ProcessInfo.processInfo.globallyUniqueString).sqlite"
|
||||
let databasePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(databaseFileName)
|
||||
let modelURL = Bundle(for: type(of: self)).url(forResource: "PerformanceModel", withExtension: "momd")!
|
||||
let mom = NSManagedObjectModel(contentsOf: modelURL)!
|
||||
|
||||
measure {
|
||||
let psc = NSPersistentStoreCoordinator(managedObjectModel: mom)
|
||||
let store = try! psc.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: URL(fileURLWithPath: databasePath), options: nil)
|
||||
let moc = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)
|
||||
moc.persistentStoreCoordinator = psc
|
||||
|
||||
for i in 0..<insertedRowCount {
|
||||
let item = NSEntityDescription.insertNewObject(forEntityName: "Item", into: moc)
|
||||
item.setValue(NSNumber(value: i), forKey: "i0")
|
||||
item.setValue(NSNumber(value: i), forKey: "i1")
|
||||
item.setValue(NSNumber(value: i), forKey: "i2")
|
||||
item.setValue(NSNumber(value: i), forKey: "i3")
|
||||
item.setValue(NSNumber(value: i), forKey: "i4")
|
||||
item.setValue(NSNumber(value: i), forKey: "i5")
|
||||
item.setValue(NSNumber(value: i), forKey: "i6")
|
||||
item.setValue(NSNumber(value: i), forKey: "i7")
|
||||
item.setValue(NSNumber(value: i), forKey: "i8")
|
||||
item.setValue(NSNumber(value: i), forKey: "i9")
|
||||
}
|
||||
try! moc.save()
|
||||
try! psc.remove(store)
|
||||
try! FileManager.default.removeItem(atPath: databasePath)
|
||||
}
|
||||
}
|
||||
|
||||
func testRealm() {
|
||||
let databaseFileName = "GRDBPerformanceTests-\(ProcessInfo.processInfo.globallyUniqueString).realm"
|
||||
let databasePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(databaseFileName)
|
||||
let databaseURL = URL(fileURLWithPath: databasePath)
|
||||
|
||||
measure {
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
let realm = try! Realm(fileURL: databaseURL)
|
||||
|
||||
try! realm.write {
|
||||
for i in 0..<insertedRowCount {
|
||||
realm.add(RealmItem(i0: i, i1: i, i2: i, i3: i, i4: i, i5: i, i6: i, i7: i, i8: i, i9: i))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
private let insertedRowCount = 50_000
|
||||
|
||||
// Here we insert records.
|
||||
class InsertRecordEncodableTests: XCTestCase {
|
||||
|
||||
func testGRDB() {
|
||||
struct Item: Encodable, PersistableRecord {
|
||||
var i0: Int
|
||||
var i1: Int
|
||||
var i2: Int
|
||||
var i3: Int
|
||||
var i4: Int
|
||||
var i5: Int
|
||||
var i6: Int
|
||||
var i7: Int
|
||||
var i8: Int
|
||||
var i9: Int
|
||||
}
|
||||
|
||||
let databaseFileName = "GRDBPerformanceTests-\(ProcessInfo.processInfo.globallyUniqueString).sqlite"
|
||||
let databasePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(databaseFileName)
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
defer {
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM item")!, insertedRowCount)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MIN(i0) FROM item")!, 0)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MAX(i9) FROM item")!, insertedRowCount - 1)
|
||||
}
|
||||
try! FileManager.default.removeItem(atPath: databasePath)
|
||||
}
|
||||
|
||||
measure {
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
try db.execute(sql: "CREATE TABLE item (i0 INT, i1 INT, i2 INT, i3 INT, i4 INT, i5 INT, i6 INT, i7 INT, i8 INT, i9 INT)")
|
||||
}
|
||||
|
||||
try! dbQueue.inTransaction { db in
|
||||
for i in 0..<insertedRowCount {
|
||||
try Item(i0: i, i1: i, i2: i, i3: i, i4: i, i5: i, i6: i, i7: i, i8: i, i9: i).insert(db)
|
||||
}
|
||||
return .commit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-87
@@ -1,87 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
private let insertedRowCount = 50_000
|
||||
|
||||
/// A record optimized for batch insert performance
|
||||
private struct Item: Codable, FetchableRecord, PersistableRecord {
|
||||
var i0: Int
|
||||
var i1: Int
|
||||
var i2: Int
|
||||
var i3: Int
|
||||
var i4: Int
|
||||
var i5: Int
|
||||
var i6: Int
|
||||
var i7: Int
|
||||
var i8: Int
|
||||
var i9: Int
|
||||
|
||||
static func optimizedInsertStatement(_ db: Database) throws -> Statement {
|
||||
try db.makeStatement(literal: """
|
||||
INSERT INTO \(self) (
|
||||
\(CodingKeys.i0),
|
||||
\(CodingKeys.i1),
|
||||
\(CodingKeys.i2),
|
||||
\(CodingKeys.i3),
|
||||
\(CodingKeys.i4),
|
||||
\(CodingKeys.i5),
|
||||
\(CodingKeys.i6),
|
||||
\(CodingKeys.i7),
|
||||
\(CodingKeys.i8),
|
||||
\(CodingKeys.i9))
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
""")
|
||||
}
|
||||
|
||||
func insert(with statement: Statement) throws {
|
||||
statement.setUncheckedArguments([
|
||||
i0,
|
||||
i1,
|
||||
i2,
|
||||
i3,
|
||||
i4,
|
||||
i5,
|
||||
i6,
|
||||
i7,
|
||||
i8,
|
||||
i9])
|
||||
try statement.execute()
|
||||
}
|
||||
}
|
||||
|
||||
class InsertRecordOptimizedTests: XCTestCase {
|
||||
func testGRDB() {
|
||||
let databaseFileName = "GRDBPerformanceTests-\(ProcessInfo.processInfo.globallyUniqueString).sqlite"
|
||||
let databasePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(databaseFileName)
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
defer {
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM item")!, insertedRowCount)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MIN(i0) FROM item")!, 0)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MAX(i9) FROM item")!, insertedRowCount - 1)
|
||||
}
|
||||
try! FileManager.default.removeItem(atPath: databasePath)
|
||||
}
|
||||
|
||||
let options = XCTMeasureOptions()
|
||||
options.iterationCount = 50
|
||||
measure(options: options) {
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
try db.execute(sql: "CREATE TABLE item (i0 INT, i1 INT, i2 INT, i3 INT, i4 INT, i5 INT, i6 INT, i7 INT, i8 INT, i9 INT)")
|
||||
}
|
||||
|
||||
try! dbQueue.inTransaction { db in
|
||||
let statement = try Item.optimizedInsertStatement(db)
|
||||
for i in 0..<insertedRowCount {
|
||||
let item = Item(i0: i, i1: i, i2: i, i3: i, i4: i, i5: i, i6: i, i7: i, i8: i, i9: i)
|
||||
try item.insert(with: statement)
|
||||
}
|
||||
return .commit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
import XCTest
|
||||
import GRDB
|
||||
|
||||
private let insertedRowCount = 50_000
|
||||
|
||||
// Here we insert records.
|
||||
class InsertRecordStructTests: XCTestCase {
|
||||
|
||||
func testGRDB() {
|
||||
struct Item: PersistableRecord {
|
||||
var i0: Int
|
||||
var i1: Int
|
||||
var i2: Int
|
||||
var i3: Int
|
||||
var i4: Int
|
||||
var i5: Int
|
||||
var i6: Int
|
||||
var i7: Int
|
||||
var i8: Int
|
||||
var i9: Int
|
||||
|
||||
func encode(to container: inout PersistenceContainer) {
|
||||
container["i0"] = i0
|
||||
container["i1"] = i1
|
||||
container["i2"] = i2
|
||||
container["i3"] = i3
|
||||
container["i4"] = i4
|
||||
container["i5"] = i5
|
||||
container["i6"] = i6
|
||||
container["i7"] = i7
|
||||
container["i8"] = i8
|
||||
container["i9"] = i9
|
||||
}
|
||||
}
|
||||
|
||||
let databaseFileName = "GRDBPerformanceTests-\(ProcessInfo.processInfo.globallyUniqueString).sqlite"
|
||||
let databasePath = (NSTemporaryDirectory() as NSString).appendingPathComponent(databaseFileName)
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
defer {
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT COUNT(*) FROM item")!, insertedRowCount)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MIN(i0) FROM item")!, 0)
|
||||
XCTAssertEqual(try Int.fetchOne(db, sql: "SELECT MAX(i9) FROM item")!, insertedRowCount - 1)
|
||||
}
|
||||
try! FileManager.default.removeItem(atPath: databasePath)
|
||||
}
|
||||
|
||||
measure {
|
||||
_ = try? FileManager.default.removeItem(atPath: databasePath)
|
||||
|
||||
let dbQueue = try! DatabaseQueue(path: databasePath)
|
||||
try! dbQueue.inDatabase { db in
|
||||
try db.execute(sql: "CREATE TABLE item (i0 INT, i1 INT, i2 INT, i3 INT, i4 INT, i5 INT, i6 INT, i7 INT, i8 INT, i9 INT)")
|
||||
}
|
||||
|
||||
try! dbQueue.inTransaction { db in
|
||||
for i in 0..<insertedRowCount {
|
||||
try Item(i0: i, i1: i, i2: i, i3: i, i4: i, i5: i, i6: i, i7: i, i8: i, i9: i).insert(db)
|
||||
}
|
||||
return .commit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="9525" systemVersion="15B42" minimumToolsVersion="Xcode 7.0">
|
||||
<entity name="Item" representedClassName="NSManagedObject" syncable="YES">
|
||||
<attribute name="i0" optional="YES" attributeType="Integer 64" syncable="YES"/>
|
||||
<attribute name="i1" optional="YES" attributeType="Integer 64" syncable="YES"/>
|
||||
<attribute name="i2" optional="YES" attributeType="Integer 64" syncable="YES"/>
|
||||
<attribute name="i3" optional="YES" attributeType="Integer 64" syncable="YES"/>
|
||||
<attribute name="i4" optional="YES" attributeType="Integer 64" syncable="YES"/>
|
||||
<attribute name="i5" optional="YES" attributeType="Integer 64" syncable="YES"/>
|
||||
<attribute name="i6" optional="YES" attributeType="Integer 64" syncable="YES"/>
|
||||
<attribute name="i7" optional="YES" attributeType="Integer 64" syncable="YES"/>
|
||||
<attribute name="i8" optional="YES" attributeType="Integer 64" syncable="YES"/>
|
||||
<attribute name="i9" optional="YES" attributeType="Integer 64" syncable="YES"/>
|
||||
</entity>
|
||||
<elements>
|
||||
<element name="Item" positionX="-63" positionY="-18" width="128" height="195"/>
|
||||
</elements>
|
||||
</model>
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
#if GRDB_COMPARE
|
||||
import SQLite
|
||||
import RealmSwift
|
||||
#endif
|
||||
|
||||
|
||||
#if GRDB_COMPARE
|
||||
|
||||
// MARK:- SQLite
|
||||
|
||||
let itemTable = Table("item")
|
||||
let i0Column = Expression<Int>("i0")
|
||||
let i1Column = Expression<Int>("i1")
|
||||
let i2Column = Expression<Int>("i2")
|
||||
let i3Column = Expression<Int>("i3")
|
||||
let i4Column = Expression<Int>("i4")
|
||||
let i5Column = Expression<Int>("i5")
|
||||
let i6Column = Expression<Int>("i6")
|
||||
let i7Column = Expression<Int>("i7")
|
||||
let i8Column = Expression<Int>("i8")
|
||||
let i9Column = Expression<Int>("i9")
|
||||
|
||||
|
||||
// MARK: - Realm
|
||||
|
||||
class RealmItem: RealmSwift.Object {
|
||||
@objc dynamic var i0: Int = 0
|
||||
@objc dynamic var i1: Int = 0
|
||||
@objc dynamic var i2: Int = 0
|
||||
@objc dynamic var i3: Int = 0
|
||||
@objc dynamic var i4: Int = 0
|
||||
@objc dynamic var i5: Int = 0
|
||||
@objc dynamic var i6: Int = 0
|
||||
@objc dynamic var i7: Int = 0
|
||||
@objc dynamic var i8: Int = 0
|
||||
@objc dynamic var i9: Int = 0
|
||||
|
||||
convenience init(i0: Int, i1: Int, i2: Int, i3: Int, i4: Int, i5: Int, i6: Int, i7: Int, i8: Int, i9: Int) {
|
||||
self.init()
|
||||
self.i0 = i0
|
||||
self.i1 = i1
|
||||
self.i2 = i2
|
||||
self.i3 = i3
|
||||
self.i4 = i4
|
||||
self.i5 = i5
|
||||
self.i6 = i6
|
||||
self.i7 = i7
|
||||
self.i8 = i8
|
||||
self.i9 = i9
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user