Skip to content

Commit

Permalink
Revert accidentally included change
Browse files Browse the repository at this point in the history
  • Loading branch information
CraigMacomber committed Jan 3, 2025
1 parent f41e574 commit eba5668
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions packages/dds/tree/src/test/simple-tree/simpleTree.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@

import { strict as assert, fail } from "node:assert";

import {
BenchmarkType,
benchmark,
isInPerformanceTestingMode,
type BenchmarkTimer,
} from "@fluid-tools/benchmark";
import { BenchmarkType, benchmark, isInPerformanceTestingMode } from "@fluid-tools/benchmark";
import {
type DeepTreeNode,
generateDeepSimpleTree,
Expand Down Expand Up @@ -122,26 +117,18 @@ describe("SimpleTree benchmarks", () => {
assert.equal(readNumber, expectedValue);
},
});

let flexTree: RootNode | undefined;
benchmark({
type: BenchmarkType.Measurement,
title: `${title} (flex node)`,
benchmarkFnCustom: async <T>(state: BenchmarkTimer<T>) => {
const flexTree = flexNodeInitFunction();

let duration: number;
do {
let counter = state.iterationsPerBatch;
const before = state.timer.now();
while (counter--) {
readNumber = treeReadingFunction(flexTree);
}
const after = state.timer.now();

assert.equal(readNumber, expectedValue);

duration = state.timer.toSeconds(before, after);
} while (state.recordBatch(duration));
before: () => {
flexTree = flexNodeInitFunction();
},
benchmarkFn: () => {
readNumber = treeReadingFunction(flexTree ?? fail("Expected flexTree to be set"));
},
after: () => {
assert.equal(readNumber, expectedValue);
},
});
}
Expand Down

0 comments on commit eba5668

Please sign in to comment.