summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2022-03-07 11:12:16 +0100
committerGitHub <noreply@github.com>2022-03-07 11:12:16 +0100
commitf65529aa67664d7ec90b8fb861686aac3ebc4a56 (patch)
treed96bf00edf0972205d36621486b1f8e68ad394d0 /cli
parentd5642f5df735f4e97e79e1d5ba47ec8e588d4b02 (diff)
bench(common): base64 short strings (#13851)
Diffstat (limited to 'cli')
-rw-r--r--cli/bench/deno_common.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/cli/bench/deno_common.js b/cli/bench/deno_common.js
index 66557952a..71195b32e 100644
--- a/cli/bench/deno_common.js
+++ b/cli/bench/deno_common.js
@@ -37,13 +37,19 @@ function benchStats(name, n, t1, t2) {
`n = ${n}, dt = ${dt.toFixed(3)}s, r = ${r.toFixed(0)}/s, t = ${ns}ns/op`;
}
-function benchBase64RoundTrip() {
+function benchB64RtLong() {
const input = "long-string".repeat(99999);
- benchSync("base64_roundtrip", 10, () => {
+ benchSync("b64_rt_long", 1e2, () => {
atob(btoa(input));
});
}
+function benchB64RtShort() {
+ benchSync("b64_rt_short", 1e6, () => {
+ atob(btoa("123"));
+ });
+}
+
function benchUrlParse() {
benchSync("url_parse", 5e4, (i) => {
new URL(`http://www.google.com/${i}`);
@@ -117,7 +123,8 @@ async function main() {
// A common "language feature", that should be fast
// also a decent representation of a non-trivial JSON-op
benchUrlParse();
- benchBase64RoundTrip();
+ benchB64RtLong();
+ benchB64RtShort();
// IO ops
benchReadZero();
benchWriteNull();