Files
discordeno/bench/memory.ts
Skillz4Killz c1efa83bd9 Bot pkg (#2740)
* fix: bot pkg test

* Fix code style issues with ESLint

* Update Guild.ts

* Update Guild.ts

* Fix code style issues with ESLint

Co-authored-by: Lint Action <lint-action@samuelmeuli.com>
Co-authored-by: Jonathan Ho <heiheiho000@gmail.com>
2023-01-26 09:11:24 -06:00

29 lines
856 B
TypeScript

import { memoryBenchmarks } from "https://raw.githubusercontent.com/discordeno/benchmarks/main/index.ts";
import { createBot } from '../mod.ts.js';
import { enableCachePlugin } from '../plugins/mod.ts.js';
const results = await memoryBenchmarks(() =>
enableCachePlugin(createBot({
token: " ",
botId: 0n,
}))
);
const output: Array<{
name: string;
value: number;
range: string;
unit: string;
}> = JSON.parse(await Deno.readTextFile("output.txt"));
for (const resultKey of Object.keys(results.Cached) as Array<keyof typeof results.Cached>) {
output.push({
name: `[Cache Plugin] ${resultKey.toString()}`,
value: results.Cached[resultKey].value,
range: `${results.Cached[resultKey].min}${results.Cached[resultKey].max}`,
unit: "MB",
});
}
Deno.writeTextFile("output.txt", JSON.stringify(output, undefined, 2));