mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Make request.method getter not allocate memory (#18961)
This commit is contained in:
14
bench/snippets/request-method-getter.mjs
Normal file
14
bench/snippets/request-method-getter.mjs
Normal file
@@ -0,0 +1,14 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const url = "http://localhost:3000/";
|
||||
const clonable = new Request(url);
|
||||
|
||||
bench("request.clone().method", () => {
|
||||
return clonable.clone().method;
|
||||
});
|
||||
|
||||
bench("new Request(url).method", () => {
|
||||
return new Request(url).method;
|
||||
});
|
||||
|
||||
await run();
|
||||
Reference in New Issue
Block a user