From fe774b35378faaaf451e3d90794fdfe3b896b953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sat, 26 Sep 2026 12:58:39 +0200 Subject: [PATCH] Performance tests for String as a statement argument --- .../GRDBPerformance/FetchStringTests.swift | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Tests/Performance/GRDBPerformance/FetchStringTests.swift b/Tests/Performance/GRDBPerformance/FetchStringTests.swift index 411158be0..bf74f25dc 100644 --- a/Tests/Performance/GRDBPerformance/FetchStringTests.swift +++ b/Tests/Performance/GRDBPerformance/FetchStringTests.swift @@ -38,6 +38,30 @@ class FetchStringTests: XCTestCase { func test_longString_databaseValue_performance() throws { try measureFetch(of: DatabaseValue.self, from: "long") } + + func test_shortString_as_argument() throws { + let dbQueue = try DatabaseQueue() + try dbQueue.write { db in + let statement = try db.makeStatement(sql: "SELECT ? WHERE 0") + measure { + for _ in 0..<100_000 { + try! statement.execute(arguments: [FetchStringTests.shortString]) + } + } + } + } + + func test_longString_as_argument() throws { + let dbQueue = try DatabaseQueue() + try dbQueue.write { db in + let statement = try db.makeStatement(sql: "SELECT ? WHERE 0") + measure { + for _ in 0..<100_000 { + try! statement.execute(arguments: [FetchStringTests.longString]) + } + } + } + } func test_record_fetch_performance() throws { let dbQueue = try makePersonDatabase()