Files
bun.sh/bench/snippets/encode-into.mjs
Jarred Sumner 4eed310a45 3x faster TextEncoder.prototype.encodeInto
thanks to @Constellation for the tip
2022-12-01 18:51:16 -08:00

11 lines
231 B
JavaScript

import { run, bench } from "../node_modules/mitata/src/cli.mjs";
const encoder = new TextEncoder();
const buffer = new Uint8Array(1024);
bench("encodeInto", () => {
encoder.encodeInto("Hello World!", buffer);
});
await run();