Skip to content

Commit 53651f5

Browse files
committed
Adjust benchmark script with new imports and add some more progress logs
1 parent 263623d commit 53651f5

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

benchmark.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ const LoggerModule = proxyquireNonStrict("./src/logger", {
1212
obsidian: obsidianMocks,
1313
});
1414

15-
const GithubClientModule = proxyquireNonStrict("./src/github/client", {
16-
obsidian: obsidianMocks,
17-
});
18-
1915
const MetadataStoreModule = proxyquireNonStrict("./src/metadata-store", {
2016
obsidian: obsidianMocks,
2117
});
@@ -29,6 +25,11 @@ const UtilsModule = proxyquireNonStrict("./src/utils", {
2925
obsidian: obsidianMocks,
3026
});
3127

28+
const GithubClientModule = proxyquireNonStrict("./src/github/client", {
29+
obsidian: obsidianMocks,
30+
"src/utils": UtilsModule,
31+
});
32+
3233
const SyncManagerModule = proxyquireNonStrict("./src/sync-manager", {
3334
obsidian: obsidianMocks,
3435
"./metadata-store": MetadataStoreModule,
@@ -228,7 +229,7 @@ const BENCHMARK_DATA = [
228229
const results = [];
229230
for (const data of BENCHMARK_DATA) {
230231
console.log(
231-
`Running benchmark for ${data.files} files of ${data.fileSize} bytes`,
232+
`Running benchmark with ${data.files} files totaling ${data.fileSize} bytes`,
232233
);
233234
const vaultRootDir = path.join(
234235
benchmarkRootDir,
@@ -243,12 +244,14 @@ const BENCHMARK_DATA = [
243244
);
244245

245246
// Run first sync by uploading all local files
247+
console.log("First sync from local");
246248
const uploadTime = await runBenchmark(vaultRootDir);
247249

248250
// Cleanup vault dir completely
249251
fs.rmSync(vaultRootDir, { recursive: true, force: true });
250252

251253
// Run first sync again, this time we download the files we just uploaded
254+
console.log("Second sync from remote");
252255
const downloadTime = await runBenchmark(vaultRootDir);
253256

254257
// Cleanup the remote repo so it's ready for another benchmark
@@ -262,6 +265,10 @@ const BENCHMARK_DATA = [
262265

263266
// Cleanup vault dir again, it's not necessary to keep it around
264267
fs.rmSync(vaultRootDir, { recursive: true, force: true });
268+
269+
// Wait 2 seconds between each run just to avoid annoying Github
270+
await new Promise((resolve) => setTimeout(resolve, 2000));
271+
console.log("");
265272
}
266273
fs.writeFileSync("benchmark_result.json", JSON.stringify(results), {
267274
flag: "w",

0 commit comments

Comments
 (0)