Created
January 11, 2023 02:27
-
-
Save okayurisotto/f5c602aa480bf16007e8235f7a673f21 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const loop = 100000000; | |
Deno.bench("hoge", () => { | |
function f(n: number): number { | |
function g(): number { | |
return n; | |
} | |
return g(); | |
} | |
for (let i = 0; i < loop; i++) { | |
f(1); | |
} | |
}); | |
Deno.bench("fuga", () => { | |
function g(n: number): number { | |
return n; | |
} | |
function f(n: number): number { | |
return g(n); | |
} | |
for (let i = 0; i < loop; i++) { | |
f(1); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpu: AMD Ryzen 5 5600X 6-Core Processor | |
runtime: deno 1.29.2 (x86_64-unknown-linux-gnu) | |
file:///home/okayurisotto/tmp/main.ts | |
benchmark time (avg) (min … max) p75 p99 p995 | |
------------------------------------------------- ----------------------------- | |
hoge 22.04 ms/iter (21.64 ms … 24.32 ms) 22.08 ms 24.32 ms 24.32 ms | |
fuga 22.1 ms/iter (21.69 ms … 23.46 ms) 22.23 ms 23.46 ms 23.46 ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment