Files
discordeno/performance/memory.ts
Jonathan Ho 7a1a41fac8 CI: Run benchmark (#2563)
* fix(bench): try to fix benchmark

* style: deno fmt

* fix: remove check formating

* fix: add fake token

* fix: tranform

* deno fmt

* add parseFloat

* fix unit

* refactor: change fetch target to benchrepo

* fix: oldBot

* refactor: use custom input

* ci: add tee

* style: deno fmt

* ci: cache deps

* chore: remove

* ci: add memory benchmark

* fix: fix url for main repo

* deno fmt

* ci: add comment-always

* fix: link

* just trying trigger

* ci: only push on main

* fix: type

* fix: range

* fixed

* style: deno fmt

* fix: path

* Add upload output

* style: deno fmt

* ci: add create branch on pr owner's repo

* fix: github.repository

* ci: fix remove id benchmark-action

* fix

* fix: type

* reverse change

* ci: add cache

* feat: add using cache

* bench: update name and ignore previous when ci

* style: name

* feat: fix pr message style

* add more benchmark

* deno fmt

* fix

* fix: wording

* chore: only run on success

* fix: used last head as current commit
2022-10-29 14:22:23 -05:00

29 lines
842 B
TypeScript

import { memoryBenchmarks } from "https://raw.githubusercontent.com/discordeno/benchmarks/main/index.ts";
import { createBot } from "../mod.ts";
import { enableCachePlugin } from "../plugins/mod.ts";
const results = await memoryBenchmarks(() =>
enableCachePlugin(createBot({
token: " ",
botId: 0n,
}))
);
const output: {
name: string;
value: number;
range: string;
unit: string;
}[] = JSON.parse(await Deno.readTextFile("output.txt"));
for (const resultKey of Object.keys(results.Cached) as (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));