summaryrefslogtreecommitdiff
path: root/cli/bench/deno_common.js
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2022-03-05 02:15:24 +0530
committerGitHub <noreply@github.com>2022-03-04 21:45:24 +0100
commit18a3a0ba7565177f5fc2a1bce93b65c34f598a51 (patch)
treee6f75a04898dcd26f9d17b0b62887aa621fdaaaf /cli/bench/deno_common.js
parent060dabee4c0411015f60867f3efd933c25a19a2c (diff)
bench: add base64 roundtrip (#13839)
Diffstat (limited to 'cli/bench/deno_common.js')
-rw-r--r--cli/bench/deno_common.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/bench/deno_common.js b/cli/bench/deno_common.js
index 8863261a0..66557952a 100644
--- a/cli/bench/deno_common.js
+++ b/cli/bench/deno_common.js
@@ -37,6 +37,13 @@ function benchStats(name, n, t1, t2) {
`n = ${n}, dt = ${dt.toFixed(3)}s, r = ${r.toFixed(0)}/s, t = ${ns}ns/op`;
}
+function benchBase64RoundTrip() {
+ const input = "long-string".repeat(99999);
+ benchSync("base64_roundtrip", 10, () => {
+ atob(btoa(input));
+ });
+}
+
function benchUrlParse() {
benchSync("url_parse", 5e4, (i) => {
new URL(`http://www.google.com/${i}`);
@@ -110,6 +117,7 @@ async function main() {
// A common "language feature", that should be fast
// also a decent representation of a non-trivial JSON-op
benchUrlParse();
+ benchBase64RoundTrip();
// IO ops
benchReadZero();
benchWriteNull();