profiterole/example/simple.ts
2024-06-03 03:07:55 +02:00

32 lines
759 B
TypeScript
Executable file

#!/usr/bin/env -S deno run -A --unstable-temporal
Deno.env.set("PROFILE", "true");
import { report, section, startup, tip, top } from "../mod.ts";
import { range } from "../src/lib/utils.ts";
async function main() {
await startup();
console.log("Starting ...");
const data = Array.from(range(0, 100));
const results = new Map<string, number>();
for (const a of data) {
// with tip/top
tip("table_of_it");
for (const b of data) {
tip("iteration");
const result = a + b;
// with section
const key = section("serialize", () => JSON.stringify({ a, b }));
section("insertion", () => results.set(key, result));
top("iteration");
}
top("table_of_it");
}
console.log("Done.");
report();
}
if (import.meta.main) await main();