Performance: Deno standard library overview
This affects the initial load time and runtime performance by controlling which utilities and modules are included and how they are loaded.
import { readFileSync } from "https://deno.land/std@0.203.0/fs/mod.ts"; const data = readFileSync("file.txt");
import * as std from "https://deno.land/std@0.203.0/mod.ts"; const data = std.fs.readFileSync("file.txt");
| Pattern | Module Size | Fetch Time | Compile Time | Verdict |
|---|---|---|---|---|
| Import entire std library | Large (500kb+) | High (blocks startup) | High (parsing large code) | [X] Bad |
| Import specific std module | Small (few kb) | Low (fast fetch) | Low (quick compile) | [OK] Good |
import { format } from "https://deno.land/std@0.200.0/datetime/mod.ts";
const date = new Date("2024-06-15T12:00:00Z");
console.log(format(date, "yyyy-MM-dd"));import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
assertEquals(1 + 1, 2);Pass the test and this pattern moves unknown