mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
* wip * wip * Fix bug with stdin * zig fmt * seems to work! * Update streams.test.js Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
|
|
|
// pure JS implementation will optimze this out
|
|
// bench("new Headers", function () {
|
|
// return new Headers();
|
|
// });
|
|
|
|
var big = new Headers({
|
|
"Content-Type": "text/plain",
|
|
"Content-Length": "123",
|
|
hello: "there",
|
|
"X-Custom-Header": "Hello World",
|
|
"X-Another-Custom-Header": "Hello World",
|
|
"X-Yet-Another-Custom-ader": "Hello World",
|
|
"X-Yet-Another-Custom-Heder": "Hello World",
|
|
"X-Yet-Another-Custom-Heade": "Hello World",
|
|
"X-Yet-Another-Custom-Headz": "Hello Worlda",
|
|
});
|
|
|
|
// bench("Header.get", function () {
|
|
// return big.get("Content-Type");
|
|
// });
|
|
|
|
// bench("Header.set (standard)", function () {
|
|
// return big.set("Content-Type", "text/html");
|
|
// });
|
|
|
|
// bench("Header.set (non-standard)", function () {
|
|
// return big.set("X-My-Custom", "text/html123");
|
|
// });
|
|
|
|
if (big.toJSON)
|
|
bench("Headers.toJSON", function () {
|
|
return big.toJSON();
|
|
});
|
|
|
|
bench("Object.fromEntries(headers.entries())", function () {
|
|
return Object.fromEntries(big.entries());
|
|
});
|
|
|
|
bench("Object.fromEntries(headers)", function () {
|
|
return Object.fromEntries(big);
|
|
});
|
|
|
|
run();
|