test(perf): rebuild gate in the §1.1 shape on both dialects, every column compared
- The rebuild gate adopts 400 sequences of 250 real photos (one fifth of the §1.1 library, same frames per sequence) and runs on SQLite and PostgreSQL. - The rebuilt index is compared with the original in every column of every sequence and frame (only UpdatedAt, the rebuild time, is left out), and the first differing row is named. - Synthetic frames are seeded by the sequence's position, so every run builds the same library; the Library open gate says it runs on a new connection pool with a warm OS cache instead of calling it cold. Measured locally (PostgreSQL 16): Library open 259 ms SQLite / 181 ms PostgreSQL, filters <= 6.4 ms; rebuild of 100,000 frames 1.8 s SQLite / 4.7 s PostgreSQL (budget 120 s). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
3 files changed
+86
-51
No files matched your search
@@ -7,8 +7,10 @@ namespace Titano.Data.Tests.Perf;
|
||||
|
||||
/// <summary>
|
||||
/// §1.1 / Phase 3 gate on the 500,000-photo library: the Library opens (archive totals, filter lists and the first
|
||||
/// page, exactly what the Library screen asks at start) in under 1 s on a cold index, and every filter, search and
|
||||
/// sort answers its first page plus the total in under 200 ms. Opt-in: <c>TITANO_PERF=1</c>.
|
||||
/// page, exactly what the Library screen asks at start) in under 1 s on its first query through a new connection pool,
|
||||
/// and every filter, search and sort answers its first page plus the total in under 200 ms. The index was just written
|
||||
/// by the same machine, so the OS page cache (and PostgreSQL's shared buffers) are warm: the gate covers query plans
|
||||
/// and indexes, not a disk read after a reboot. Opt-in: <c>TITANO_PERF=1</c>.
|
||||
/// </summary>
|
||||
[Category("perf")]
|
||||
[RequiresEnvironment(PerfGate.Variable)]
|
||||
@@ -25,14 +27,14 @@ public abstract class LibraryPerfTests(TestContext context) : RepositoryTest(con
|
||||
var options = await NewOptionsAsync(multiConnection: true);
|
||||
await using (var build = await TitanoDatabase.OpenAsync(options, Ct)) await SyntheticLibrary.BuildAsync(build, Context);
|
||||
|
||||
// A new connection pool and page cache, as at application start.
|
||||
// A new connection pool and SQLite page cache, as at application start.
|
||||
var db = Own(await TitanoDatabase.OpenAsync(options, Ct));
|
||||
var cold = await PerfGate.TimeAsync(() => OpenLibraryAsync(db));
|
||||
var warm = await PerfGate.MedianAsync(() => OpenLibraryAsync(db));
|
||||
Context.Log($"perf: {Dialect} library open {cold:F0} ms cold, {warm:F0} ms warm (budget {OpenBudgetMs:F0} ms)");
|
||||
var first = await PerfGate.TimeAsync(() => OpenLibraryAsync(db));
|
||||
var again = await PerfGate.MedianAsync(() => OpenLibraryAsync(db));
|
||||
Context.Log($"perf: {Dialect} library open {first:F0} ms first, {again:F0} ms again (budget {OpenBudgetMs:F0} ms)");
|
||||
|
||||
var failures = new List<string>();
|
||||
if (cold > OpenBudgetMs) failures.Add($"open {cold:F0} ms");
|
||||
if (first > OpenBudgetMs) failures.Add($"open {first:F0} ms");
|
||||
var firstPage = await db.Sequences.ListAsync(new SequenceQuery { Limit = 200 }, Ct);
|
||||
foreach (var (name, query) in Filters(firstPage.NextCursor))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user