@remnic/bench 9.3.574 → 9.3.576
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +35 -18
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -22304,10 +22304,10 @@ function parseNonNegativeInt(rawValue) {
|
|
|
22304
22304
|
}
|
|
22305
22305
|
|
|
22306
22306
|
// src/benchmarks/remnic/page-versioning/runner.ts
|
|
22307
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
22308
|
+
import { mkdir as mkdir8, mkdtemp as mkdtemp4, readFile as readFile16, rm as rm4, writeFile as writeFile8 } from "fs/promises";
|
|
22307
22309
|
import os6 from "os";
|
|
22308
22310
|
import path21 from "path";
|
|
22309
|
-
import { randomUUID as randomUUID14 } from "crypto";
|
|
22310
|
-
import { mkdtemp as mkdtemp4, mkdir as mkdir8, readFile as readFile16, rm as rm4, writeFile as writeFile8 } from "fs/promises";
|
|
22311
22311
|
import {
|
|
22312
22312
|
createVersion,
|
|
22313
22313
|
diffVersions,
|
|
@@ -22369,12 +22369,23 @@ var pageVersioningDefinition = {
|
|
|
22369
22369
|
citation: "Remnic internal synthetic benchmark for issue #445"
|
|
22370
22370
|
}
|
|
22371
22371
|
};
|
|
22372
|
-
|
|
22372
|
+
var DEFAULT_PAGE_VERSIONING_DEPENDENCIES = {
|
|
22373
|
+
createVersion,
|
|
22374
|
+
diffVersions,
|
|
22375
|
+
getVersion,
|
|
22376
|
+
listVersions,
|
|
22377
|
+
revertToVersion
|
|
22378
|
+
};
|
|
22379
|
+
async function runPageVersioningBenchmark(options, dependencyOverrides = {}) {
|
|
22380
|
+
const dependencies = {
|
|
22381
|
+
...DEFAULT_PAGE_VERSIONING_DEPENDENCIES,
|
|
22382
|
+
...dependencyOverrides
|
|
22383
|
+
};
|
|
22373
22384
|
const cases = loadCases5(options.mode, options.limit);
|
|
22374
22385
|
const tasks = [];
|
|
22375
22386
|
for (const sample of cases) {
|
|
22376
22387
|
const startedAt = performance.now();
|
|
22377
|
-
const actual = await executeCase2(sample);
|
|
22388
|
+
const actual = await executeCase2(sample, dependencies);
|
|
22378
22389
|
const latencyMs = Math.round(performance.now() - startedAt);
|
|
22379
22390
|
const expectedJson = JSON.stringify(sample.expected);
|
|
22380
22391
|
const actualJson = JSON.stringify(actual);
|
|
@@ -22459,7 +22470,7 @@ function loadCases5(mode, limit) {
|
|
|
22459
22470
|
}
|
|
22460
22471
|
return limited;
|
|
22461
22472
|
}
|
|
22462
|
-
async function executeCase2(sample) {
|
|
22473
|
+
async function executeCase2(sample, dependencies) {
|
|
22463
22474
|
const tmpDir = await mkdtemp4(path21.join(os6.tmpdir(), "remnic-bench-page-versioning-"));
|
|
22464
22475
|
try {
|
|
22465
22476
|
const factsDir = path21.join(tmpDir, "facts");
|
|
@@ -22469,13 +22480,13 @@ async function executeCase2(sample) {
|
|
|
22469
22480
|
switch (sample.scenario) {
|
|
22470
22481
|
case "revert-flow": {
|
|
22471
22482
|
await writeFile8(pagePath, "original content", "utf-8");
|
|
22472
|
-
await createVersion(pagePath, "original content", "write", config, void 0, void 0, tmpDir);
|
|
22483
|
+
await dependencies.createVersion(pagePath, "original content", "write", config, void 0, void 0, tmpDir);
|
|
22473
22484
|
await writeFile8(pagePath, "modified content", "utf-8");
|
|
22474
|
-
await createVersion(pagePath, "modified content", "write", config, void 0, void 0, tmpDir);
|
|
22475
|
-
await revertToVersion(pagePath, "1", config, void 0, tmpDir);
|
|
22476
|
-
const history = await listVersions(pagePath, config, tmpDir);
|
|
22485
|
+
await dependencies.createVersion(pagePath, "modified content", "write", config, void 0, void 0, tmpDir);
|
|
22486
|
+
await dependencies.revertToVersion(pagePath, "1", config, void 0, tmpDir);
|
|
22487
|
+
const history = await dependencies.listVersions(pagePath, config, tmpDir);
|
|
22477
22488
|
const pageContent = await readFile16(pagePath, "utf-8");
|
|
22478
|
-
const observed = await getVersion(pagePath, "3", config, tmpDir);
|
|
22489
|
+
const observed = await dependencies.getVersion(pagePath, "3", config, tmpDir);
|
|
22479
22490
|
return {
|
|
22480
22491
|
versionIds: history.versions.map((version) => version.versionId),
|
|
22481
22492
|
currentVersion: history.currentVersion,
|
|
@@ -22488,15 +22499,18 @@ async function executeCase2(sample) {
|
|
|
22488
22499
|
for (let index = 1; index <= 4; index += 1) {
|
|
22489
22500
|
const content = `content v${index}`;
|
|
22490
22501
|
await writeFile8(pagePath, content, "utf-8");
|
|
22491
|
-
await createVersion(pagePath, content, "write", pruningConfig, void 0, void 0, tmpDir);
|
|
22502
|
+
await dependencies.createVersion(pagePath, content, "write", pruningConfig, void 0, void 0, tmpDir);
|
|
22492
22503
|
}
|
|
22493
|
-
const history = await listVersions(pagePath, pruningConfig, tmpDir);
|
|
22504
|
+
const history = await dependencies.listVersions(pagePath, pruningConfig, tmpDir);
|
|
22494
22505
|
const pageContent = await readFile16(pagePath, "utf-8");
|
|
22495
22506
|
const prunedIds = [];
|
|
22496
22507
|
for (const versionId of ["1", "2"]) {
|
|
22497
22508
|
try {
|
|
22498
|
-
await getVersion(pagePath, versionId, pruningConfig, tmpDir);
|
|
22499
|
-
} catch {
|
|
22509
|
+
await dependencies.getVersion(pagePath, versionId, pruningConfig, tmpDir);
|
|
22510
|
+
} catch (error) {
|
|
22511
|
+
if (!isMissingPageVersionError(error, pagePath, versionId)) {
|
|
22512
|
+
throw error;
|
|
22513
|
+
}
|
|
22500
22514
|
prunedIds.push(versionId);
|
|
22501
22515
|
}
|
|
22502
22516
|
}
|
|
@@ -22509,7 +22523,7 @@ async function executeCase2(sample) {
|
|
|
22509
22523
|
}
|
|
22510
22524
|
case "diff-output": {
|
|
22511
22525
|
await writeFile8(pagePath, "line 1\nline 2\nline 3", "utf-8");
|
|
22512
|
-
await createVersion(
|
|
22526
|
+
await dependencies.createVersion(
|
|
22513
22527
|
pagePath,
|
|
22514
22528
|
"line 1\nline 2\nline 3",
|
|
22515
22529
|
"write",
|
|
@@ -22519,7 +22533,7 @@ async function executeCase2(sample) {
|
|
|
22519
22533
|
tmpDir
|
|
22520
22534
|
);
|
|
22521
22535
|
await writeFile8(pagePath, "line 1\nline 2 changed\nline 3\nline 4", "utf-8");
|
|
22522
|
-
await createVersion(
|
|
22536
|
+
await dependencies.createVersion(
|
|
22523
22537
|
pagePath,
|
|
22524
22538
|
"line 1\nline 2 changed\nline 3\nline 4",
|
|
22525
22539
|
"write",
|
|
@@ -22528,9 +22542,9 @@ async function executeCase2(sample) {
|
|
|
22528
22542
|
void 0,
|
|
22529
22543
|
tmpDir
|
|
22530
22544
|
);
|
|
22531
|
-
const history = await listVersions(pagePath, config, tmpDir);
|
|
22545
|
+
const history = await dependencies.listVersions(pagePath, config, tmpDir);
|
|
22532
22546
|
const pageContent = await readFile16(pagePath, "utf-8");
|
|
22533
|
-
const diff = await diffVersions(pagePath, "1", "2", config, tmpDir);
|
|
22547
|
+
const diff = await dependencies.diffVersions(pagePath, "1", "2", config, tmpDir);
|
|
22534
22548
|
const observedLines = normalizeDiffChangedLines(diff);
|
|
22535
22549
|
return {
|
|
22536
22550
|
versionIds: history.versions.map((version) => version.versionId),
|
|
@@ -22544,6 +22558,9 @@ async function executeCase2(sample) {
|
|
|
22544
22558
|
await rm4(tmpDir, { recursive: true, force: true });
|
|
22545
22559
|
}
|
|
22546
22560
|
}
|
|
22561
|
+
function isMissingPageVersionError(error, pagePath, versionId) {
|
|
22562
|
+
return error instanceof Error && error.message === `Version ${versionId} not found for ${pagePath}`;
|
|
22563
|
+
}
|
|
22547
22564
|
function normalizeDiffChangedLines(diff) {
|
|
22548
22565
|
return diff.replace(/\r\n/g, "\n").split("\n").map((line) => line.trimEnd()).filter((line) => {
|
|
22549
22566
|
if (line.startsWith("--- version ")) return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remnic/bench",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.576",
|
|
4
4
|
"description": "Retrieval latency ladder benchmarks + CI regression gates for @remnic/core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"hyparquet": "^1.25.7",
|
|
36
36
|
"yaml": "^2.4.2",
|
|
37
|
-
"@remnic/core": "^9.3.
|
|
37
|
+
"@remnic/core": "^9.3.576"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"tsup": "^8.5.1",
|