public commit

This commit is contained in:
dswbx
2024-11-16 12:01:47 +01:00
commit 90f80c4280
582 changed files with 49291 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import { baseline, bench, group, run } from "mitata";
import * as crypt from "../../../src/core/utils/crypto";
// deno
// import { ... } from 'npm:mitata';
// d8/jsc
// import { ... } from '<path to mitata>/src/cli.mjs';
const small = "hello";
const big = "hello".repeat(1000);
group("hashing (small)", () => {
baseline("baseline", () => JSON.parse(JSON.stringify({ small })));
bench("sha-1", async () => await crypt.hash.sha256(small));
bench("sha-256", async () => await crypt.hash.sha256(small));
});
group("hashing (big)", () => {
baseline("baseline", () => JSON.parse(JSON.stringify({ big })));
bench("sha-1", async () => await crypt.hash.sha256(big));
bench("sha-256", async () => await crypt.hash.sha256(big));
});
/*group({ name: 'group2', summary: false }, () => {
bench('new Array(0)', () => new Array(0));
bench('new Array(1024)', () => new Array(1024));
});*/
// @ts-ignore
await run();