"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
const benchmark_1 = require("@fluid-tools/benchmark");
const snapshot_utils_js_1 = require("./snapshot.utils.js");
describe("MergeTree snapshots", () => {
    for (const summarySize of [10, 50, 100, 500, 1000, 5000, 10_000]) {
        const test = (0, benchmark_1.benchmarkIt)({
            title: `load snapshot with ${summarySize} segments`,
            category: "snapshot loading",
            ...(0, benchmark_1.benchmarkDuration)({
                benchmarkFnCustom: async (state) => {
                    const str = new snapshot_utils_js_1.TestString("id", {});
                    for (let i = 0; i < summarySize; i++) {
                        str.append("a", false);
                    }
                    str.applyPendingOps();
                    const summary = str.getSummary();
                    await state.timeAllBatchesAsync(async () => {
                        await (0, snapshot_utils_js_1.loadSnapshot)(summary);
                    });
                },
            }),
        });
        if (summarySize > 5000) {
            const currentTimeout = test.timeout();
            // Default value of 2 seconds causes failure around P95 for large snapshot sizes.
            test.timeout(currentTimeout === 0 ? 0 : Math.max(5000, currentTimeout));
        }
    }
});
//# sourceMappingURL=Snapshot.perf.spec.js.map