import type { Quad } from '@rdfjs/types'; import type { QuintPattern, QueryOptions, QuintStore, StoreStats } from '../quint/types'; import type { Rdf3xJoinMetrics, Rdf3xIndexMetrics, Rdf3xIndexStats, RdfDerivedIndexRefreshResult, RdfEngineColdStartPhaseStats, RdfEngineLike, RdfEngineStorageStats, RdfIndexMetrics, RdfIndexStats, RdfQuery, RdfQueryMetrics, RdfTextChunkInput, RdfTextSourceInput, RdfVectorChunkInput, RdfVectorSourceInput, RdfShadowDiff } from './types'; import type { SolidRdfEngine } from './SolidRdfEngine'; import type { Rdf3xIndex } from './Rdf3xIndex'; export type RdfBenchmarkScale = 'small' | 'medium' | 'large'; export type RdfBenchmarkCaseProfile = 'default' | 'extreme' | 'fusion' | 'all'; export declare const RDF_MODELS_SYNTHETIC_MESSAGE_QUADS = 9; export declare const RDF_MODELS_NATIVE_STRESS_MESSAGE_QUADS = 9; export declare const RDF_MODELS_NATIVE_STRESS_MESSAGE_COUNT = 1024; export declare const RDF_MODELS_SEARCH_FUSION_BROAD_SOURCE_COUNT = 32; export interface RdfModelBenchmarkCase { name: string; resource: string; purpose: string; minScale: RdfBenchmarkScale; query: { pattern: QuintPattern; options?: QueryOptions; }; expectedPlan: string[]; } export interface RdfModelQueryBenchmarkCase { name: string; resource: string; purpose: string; minScale: RdfBenchmarkScale; minReturnedRows?: number; benchmarkCache?: 'bypass' | 'preserve'; minWarmupIterations?: number; query: RdfQuery; expectedPlan: string[]; } export interface RdfModelBenchmarkRunOptions { cases?: readonly RdfModelBenchmarkCase[]; queryCases?: readonly RdfModelQueryBenchmarkCase[]; caseProfile?: RdfBenchmarkCaseProfile; scale?: RdfBenchmarkScale; iterations?: number; } export interface RdfModelRdf3xShadowBenchmarkRunOptions extends RdfModelBenchmarkRunOptions { rdf3xIndex: Rdf3xIndex; } export interface RdfModelPostgresBenchmarkRunOptions extends RdfModelBenchmarkRunOptions { refreshDerivedIndexes?: boolean; refreshMutationSources?: number; refreshMutationQuadsPerSource?: number; warmupIterations?: number; concurrency?: number; servingRegressionThresholds?: RdfModelPostgresBenchmarkGateThresholds; fusionBenchmarkThresholds?: RdfModelPostgresBenchmarkGateThresholds; fusionBenchmarkBaselines?: Record; } export interface RdfModelBenchmarkResult { name: string; resource: string; purpose: string; minScale: RdfBenchmarkScale; query: { pattern: JsonPattern; options?: QueryOptions; }; expectedPlan: string[]; planMatched: boolean; missingPlan: string[]; physicalPlan: string[]; scannedRows: number; indexChoice: string; joinOrder: string[]; fallbackReason: string | null; returnedRows: number; checksum: string; orderedChecksum: string; durationsMs: number[]; p50DurationMs: number; p95DurationMs: number; metrics: RdfIndexMetrics; indexStats: RdfIndexStats; } export interface RdfModelQueryBenchmarkResult { name: string; resource: string; purpose: string; minScale: RdfBenchmarkScale; query: JsonPattern; expectedPlan: string[]; planMatched: boolean; missingPlan: string[]; physicalPlan: string[]; scannedRows: number; indexChoices: string[]; fallbackReason: string | null; returnedRows: number; checksum: string; orderedChecksum: string; durationsMs: number[]; p50DurationMs: number; p95DurationMs: number; metrics: RdfQueryMetrics; indexStats: RdfIndexStats; } export interface RdfModelBenchmarkReport { engine: 'solid-rdf'; scale: RdfBenchmarkScale; caseProfile: RdfBenchmarkCaseProfile; iterations: number; generatedAt: string; planMatched: boolean; failedPlanCases: string[]; performanceCosts: RdfModelBenchmarkPerformanceCosts; storage: RdfEngineStorageStats; cases: RdfModelBenchmarkResult[]; queryCases: RdfModelQueryBenchmarkResult[]; } export interface RdfModelPostgresBenchmarkReport { engine: 'postgres-rdf'; scale: RdfBenchmarkScale; caseProfile: RdfBenchmarkCaseProfile; iterations: number; warmupIterations: number; concurrency: number; generatedAt: string; planMatched: boolean; failedPlanCases: string[]; concurrencyGate: RdfModelPostgresConcurrencyGate; servingRegressionGate: RdfModelPostgresServingRegressionGate; fusionBenchmarkGate: RdfModelPostgresFusionBenchmarkGate; refresh?: RdfDerivedIndexRefreshResult; refreshBenchmark?: RdfModelPostgresRefreshBenchmark; postWriteRefreshBenchmark?: RdfModelPostgresPostWriteRefreshBenchmark; coldStartBenchmark?: RdfModelPostgresColdStartBenchmark; performanceCosts: RdfModelBenchmarkPerformanceCosts; storage: RdfEngineStorageStats; cases: RdfModelBenchmarkResult[]; queryCases: RdfModelQueryBenchmarkResult[]; } export interface RdfModelBenchmarkPerformanceCosts { storageOverhead: { factsBytes: number; derivedBytes: number; totalBytes: number; derivedToFactsRatio: number; totalToFactsRatio: number; }; indexBuild?: { durationMs: number; refreshed: boolean; plannerStatsDurationMs?: number; rebuildMode?: RdfModelPostgresRefreshBenchmark['rebuildMode']; dirtyGraphs?: number; dirtyPairs?: number; dirtyTerms?: number; }; coldStart?: { durationMs?: number; }; } export interface RdfModelPostgresColdStartBenchmark { startup?: { status: NonNullable['status']; driver?: string; openCount: number; startedAt?: string; readyAt?: string; durationMs?: number; phases: RdfEngineColdStartPhaseStats[]; }; firstQueryAfterRefresh?: RdfModelPostgresColdStartQueryBenchmark; warmSteadyState?: RdfModelPostgresWarmSteadyStateBenchmark; } export interface RdfModelPostgresColdStartQueryBenchmark { queryCase: string; durationMs: number; planMatched: boolean; missingPlan: string[]; physicalPlan: string[]; indexChoices: string[]; scannedRows: number; returnedRows: number; cacheMode: 'bypass'; } export interface RdfModelPostgresWarmSteadyStateBenchmark { queryCase: string; iterations: number; warmupIterations: number; durationsMs: number[]; p50DurationMs: number; p95DurationMs: number; planMatched: boolean; returnedRows: number; } export interface RdfModelPostgresRefreshBenchmark { durationMs: number; refreshed: boolean; previousFactsDataVersion?: number; factsDataVersion?: number; syncedWithFacts?: boolean; rebuildMode?: string; dirtyGraphs?: number; dirtyPairs?: number; dirtyTerms?: number; plannerStatsDurationMs?: number; analyzedTables?: string[]; sourceQueue?: { pendingSources: number; drainedSources: number; }; } export interface RdfModelPostgresPostWriteRefreshBenchmark extends RdfModelPostgresRefreshBenchmark { mutationSources: number; mutationQuadsPerSource: number; mutationQuads: number; pendingSourcesBeforeRefresh: number; factsDataVersionBeforeRefresh?: number; matched: boolean; failedReasons: string[]; } export interface RdfModelPostgresConcurrencyGate { enabled: boolean; concurrency: number; cases: RdfModelPostgresConcurrencyGateCase[]; matched: boolean; failedCases: string[]; } export interface RdfModelPostgresBenchmarkGateThresholds { maxP95DurationMs?: number; maxDurationMs?: number; maxScannedRows?: number; cases?: Record; } export interface RdfModelPostgresBenchmarkGateCaseThresholds { maxP95DurationMs?: number; maxDurationMs?: number; maxScannedRows?: number; } export interface RdfModelPostgresBenchmarkGateBaseline { label?: string; p95DurationMs?: number; maxDurationMs?: number; scannedRows?: number; maxP95DurationMs?: number; maxScannedRows?: number; } export interface RdfModelPostgresServingRegressionGate { enabled: boolean; caseProfile: RdfBenchmarkCaseProfile; thresholds?: RdfModelPostgresBenchmarkGateThresholds; cases: RdfModelPostgresServingRegressionGateCase[]; matched: boolean; failedCases: string[]; } export interface RdfModelPostgresServingRegressionGateCase { name: string; matched: boolean; planMatched: boolean; expectedPlan: string[]; missingPlan: string[]; failedReasons: string[]; physicalPlan: string[]; scannedRows: number; returnedRows: number; p95DurationMs: number; } export interface RdfModelPostgresFusionBenchmarkGate { enabled: boolean; caseProfile: RdfBenchmarkCaseProfile; thresholds?: RdfModelPostgresBenchmarkGateThresholds; cases: RdfModelPostgresFusionBenchmarkGateCase[]; matched: boolean; failedCases: string[]; } export interface RdfModelPostgresFusionBenchmarkGateCase { name: string; matched: boolean; planMatched: boolean; failedReasons: string[]; baselineComparison?: RdfModelPostgresBenchmarkGateBaselineComparison; candidateSources: string[]; sourceEstimateCount: number; sourceChoiceCount: number; hardFiltersBeforeRank: boolean; rankInputs: boolean; rankWeights: boolean; rankTieBreaker: boolean; resultCacheBypassed: boolean; broadCandidateRows: number; batchedBroadCandidateJoin: boolean; scannedRows: number; returnedRows: number; p95DurationMs: number; } export interface RdfModelPostgresBenchmarkGateBaselineComparison { label?: string; matched: boolean; failedReasons: string[]; p95DurationMsBaseline?: number; maxP95DurationMs?: number; p95DurationMsDelta?: number; p95DurationMsRatio?: number; scannedRowsBaseline?: number; maxScannedRows?: number; scannedRowsDelta?: number; scannedRowsRatio?: number; } export interface RdfModelPostgresConcurrencyGateCase { name: string; concurrency: number; iterationsPerLane: number; matched: boolean; planMatched: boolean; expectedReturnedRows: number; returnedRows: number[]; expectedChecksum: string; checksums: string[]; expectedOrderedChecksum: string; orderedChecksums: string[]; missingPlan: string[]; durationsMs: number[]; p50DurationMs: number; p95DurationMs: number; } export interface RdfModelsBenchmarkSeedOptions { syntheticMessages: number; syntheticPodCount: number; caseProfile?: RdfBenchmarkCaseProfile; searchFusionBroadSourceCount?: number; } export interface RdfModelShadowBenchmarkRunOptions extends RdfModelBenchmarkRunOptions { } export interface RdfModelShadowBenchmarkSide { returnedRows: number; checksum: string; orderedChecksum: string; durationsMs: number[]; p50DurationMs: number; p95DurationMs: number; storeStats?: StoreStats; } export interface RdfModelShadowPerformanceComparison { p95DeltaMs: number; p95Ratio: number; matched: boolean; } export interface RdfModelShadowSpaceComparison { databaseDeltaBytes: number; tableDeltaBytes: number; indexDeltaBytes: number; databaseRatio: number; tableRatio: number; indexRatio: number; matched: boolean; unavailableReason?: string; } export interface RdfModelShadowBenchmarkResult { name: string; resource: string; purpose: string; minScale: RdfBenchmarkScale; query: { pattern: JsonPattern; options?: QueryOptions; }; expectedPlan: string[]; planMatched: boolean; missingPlan: string[]; matched: boolean; orderedMatch: boolean; diff: RdfShadowDiff; compatibility: RdfModelShadowBenchmarkSide; solidRdf: RdfModelShadowBenchmarkSide & { physicalPlan: string[]; scannedRows: number; indexChoice: string; joinOrder: string[]; fallbackReason: string | null; metrics: RdfIndexMetrics; indexStats: RdfIndexStats; }; performance: RdfModelShadowPerformanceComparison; space: RdfModelShadowSpaceComparison; } export interface RdfModelShadowBenchmarkReport { engine: 'shadow'; compatibilityEngine: 'quint-store'; candidateEngine: 'solid-rdf'; scale: RdfBenchmarkScale; caseProfile: RdfBenchmarkCaseProfile; iterations: number; generatedAt: string; matched: boolean; orderedMatched: boolean; planMatched: boolean; spaceGateEnforced: boolean; performanceMatched: boolean; spaceMatched: boolean; failedPlanCases: string[]; failedPerformanceCases: string[]; failedSpaceCases: string[]; cases: RdfModelShadowBenchmarkResult[]; } export interface RdfModelRdf3xShadowBenchmarkResult { name: string; resource: string; purpose: string; minScale: RdfBenchmarkScale; query: { pattern: JsonPattern; options?: QueryOptions; }; expectedPlan: string[]; planMatched: boolean; missingPlan: string[]; supported: boolean; unsupportedReason?: string; matched: boolean; orderedMatch: boolean; diff: RdfShadowDiff; solidRdf: RdfModelShadowBenchmarkSide & { physicalPlan: string[]; scannedRows: number; indexChoice: string; joinOrder: string[]; fallbackReason: string | null; metrics: RdfIndexMetrics; indexStats: RdfIndexStats; }; rdf3x?: RdfModelShadowBenchmarkSide & { physicalPlan: string[]; scannedRows: number; indexChoice: string; joinOrder: string[]; fallbackReason: string | null; metrics: Rdf3xIndexMetrics; indexStats: Rdf3xIndexStats; }; } export interface RdfModelRdf3xShadowJoinBenchmarkResult { name: string; resource: string; purpose: string; minScale: RdfBenchmarkScale; query: JsonPattern; expectedPlan: string[]; planMatched: boolean; missingPlan: string[]; supported: boolean; unsupportedReason?: string; matched: boolean; orderedMatch: boolean; diff: RdfShadowDiff; solidRdf: RdfModelShadowBenchmarkSide & { physicalPlan: string[]; scannedRows: number; indexChoice: string; joinOrder: string[]; fallbackReason: string | null; metrics: RdfIndexMetrics; indexStats: RdfIndexStats; }; rdf3x?: RdfModelShadowBenchmarkSide & { physicalPlan: string[]; scannedRows: number; indexChoice: string; joinOrder: string[]; fallbackReason: string | null; metrics: Rdf3xJoinMetrics; indexStats: Rdf3xIndexStats; }; } export interface RdfModelRdf3xShadowBenchmarkReport { engine: 'rdf3x-shadow'; primaryEngine: 'solid-rdf'; candidateEngine: 'solid-rdf3x'; scale: RdfBenchmarkScale; caseProfile: RdfBenchmarkCaseProfile; iterations: number; generatedAt: string; matched: boolean; orderedMatched: boolean; planMatched: boolean; skippedCases: string[]; skippedJoinCases: string[]; failedCases: string[]; failedJoinCases: string[]; failedPlanCases: string[]; rebuild: { scannedQuads: number; uniqueTriples: number; memberships: number; projectionRows: number; durationMs: number; }; storage: RdfEngineStorageStats; cases: RdfModelRdf3xShadowBenchmarkResult[]; joinCases: RdfModelRdf3xShadowJoinBenchmarkResult[]; } type JsonPattern = Record; export declare const RDF_MODELS_BENCHMARK_POD = "https://pod.example/alice"; export declare const rdfModelsBenchmarkCases: readonly RdfModelBenchmarkCase[]; export declare const rdfModelsQueryBenchmarkCases: readonly RdfModelQueryBenchmarkCase[]; export declare const rdfModelsSearchFusionQueryBenchmarkCases: readonly RdfModelQueryBenchmarkCase[]; export declare const rdfModelsPostgresMaterializedQueryBenchmarkCases: readonly RdfModelQueryBenchmarkCase[]; export declare const rdfModelsPostgresQueryBenchmarkCases: readonly RdfModelQueryBenchmarkCase[]; export declare const rdfModelsExtremeBenchmarkCases: readonly RdfModelBenchmarkCase[]; export declare const rdfModelsExtremeQueryBenchmarkCases: readonly RdfModelQueryBenchmarkCase[]; export declare function rdfModelsBenchmarkCasesForProfile(profile: RdfBenchmarkCaseProfile): readonly RdfModelBenchmarkCase[]; export declare function rdfModelsQueryBenchmarkCasesForProfile(profile: RdfBenchmarkCaseProfile): readonly RdfModelQueryBenchmarkCase[]; export declare function rdfModelsPostgresQueryBenchmarkCasesForProfile(profile: RdfBenchmarkCaseProfile): readonly RdfModelQueryBenchmarkCase[]; export declare function rdfModelsBenchmarkCaseNames(): string[]; export declare function rdfModelsQueryBenchmarkCaseNames(): string[]; export declare function rdfModelsPostgresQueryBenchmarkCaseNames(): string[]; export declare function rdfModelsPostgresMaterializedQueryBenchmarkCaseNames(): string[]; export declare function rdfModelsSearchFusionQueryBenchmarkCaseNames(): string[]; export declare function rdfModelsExtremeBenchmarkCaseNames(): string[]; export declare function rdfModelsExtremeQueryBenchmarkCaseNames(): string[]; export declare function rdfModelsBenchmarkScaleTargetQuads(scale: RdfBenchmarkScale): number; export declare function rdfModelsBenchmarkSyntheticPodCount(scale: RdfBenchmarkScale): number; export declare function estimateRdfModelsSyntheticQuadCount(syntheticMessages: number): number; export declare function syntheticMessagesForRdfModelsTargetQuads(targetQuads: number): number; export declare function defaultSyntheticMessagesForRdfModelsScale(scale: RdfBenchmarkScale): number; export declare function rdfModelsBenchmarkScaleSatisfied(scale: RdfBenchmarkScale, seedQuadCount: number): boolean; export declare function rdfModelsBenchmarkTargetSatisfied(targetQuads: number, seedQuadCount: number): boolean; export declare function buildRdfModelsBenchmarkSeed(options: RdfModelsBenchmarkSeedOptions): Quad[]; export declare function rdfModelsBenchmarkProfileRequiresSearchFusion(profile: RdfBenchmarkCaseProfile): boolean; export declare function rdfModelsSearchFusionBroadSourceCountForScale(scale: RdfBenchmarkScale): number; export declare function seedRdfModelsSearchFusionIndexes(engine: { indexTextSource(source: RdfTextSourceInput, text: string, chunks?: RdfTextChunkInput[]): void | Promise; indexVectorSource(source: RdfVectorSourceInput, chunks: RdfVectorChunkInput[]): void | Promise; }, options?: { broadSourceCount?: number; }): Promise; export declare function runRdfModelsBenchmark(engine: SolidRdfEngine, options?: RdfModelBenchmarkRunOptions): RdfModelBenchmarkReport; export declare function runRdfModelsPostgresBenchmark(engine: RdfEngineLike, options?: RdfModelPostgresBenchmarkRunOptions): Promise; export declare function postgresServingRegressionFailures(result: RdfModelQueryBenchmarkResult, thresholds?: RdfModelPostgresBenchmarkGateThresholds): string[]; export declare function runRdfModelsShadowBenchmark(engine: SolidRdfEngine, compatibilityStore: QuintStore, options?: RdfModelShadowBenchmarkRunOptions): Promise; export declare function runRdfModelsRdf3xShadowBenchmark(engine: SolidRdfEngine, options: RdfModelRdf3xShadowBenchmarkRunOptions): RdfModelRdf3xShadowBenchmarkReport; export {};