mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 01:40:08 +00:00
* 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
28 lines
823 B
TypeScript
28 lines
823 B
TypeScript
const output = await Deno.readTextFile("output.txt");
|
|
const lines = output.split(/\r?\n/g);
|
|
|
|
const ret = [];
|
|
|
|
const unitMultiplier = {
|
|
"s": 1000 * 1000 * 1000,
|
|
"ms": 1000 * 1000,
|
|
"µs": 1000,
|
|
"ns": 1,
|
|
};
|
|
|
|
for (const line of lines) {
|
|
const m = line.match(/^(.+)\s+([0-9.]+) (.s)\/iter\s+\((.+) (.s) … (.+) (.s)\)(.+)$/);
|
|
if (m === null) continue;
|
|
|
|
ret.push({
|
|
name: m[1].trim(),
|
|
value: Math.round(parseFloat(m[2]) * unitMultiplier[m[3] as keyof typeof unitMultiplier]),
|
|
range: `${Math.round(parseFloat(m[4]) * unitMultiplier[m[5] as keyof typeof unitMultiplier] * 100) / 100} … ${
|
|
Math.round(parseFloat(m[6]) * unitMultiplier[m[7] as keyof typeof unitMultiplier] * 100) / 100
|
|
}`,
|
|
unit: "ns/iter",
|
|
});
|
|
}
|
|
|
|
await Deno.writeTextFile("output.txt", JSON.stringify(ret, undefined, 2));
|