FRE-651: CEO coordination notes for founder bio/headshot assets
This commit is contained in:
25
node_modules/@stablelib/base64/base64.bench.ts
generated
vendored
Normal file
25
node_modules/@stablelib/base64/base64.bench.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2016 Dmitry Chestnykh
|
||||
// MIT License. See LICENSE file for details.
|
||||
|
||||
import { encode, decode } from "./base64";
|
||||
import { benchmark, report, byteSeq } from "@stablelib/benchmark";
|
||||
|
||||
let buf = byteSeq(1024);
|
||||
const encBuf = encode(buf);
|
||||
|
||||
report("Base64 encode", benchmark(() => encode(buf), buf.length));
|
||||
// Decode benchmark reports MiB/s for decoded MiB, not input.
|
||||
report("Base64 decode", benchmark(() => decode(encBuf), buf.length));
|
||||
|
||||
declare var Buffer: any;
|
||||
|
||||
if (typeof Buffer !== "undefined") {
|
||||
// For comparison with Node.js buffer speed.
|
||||
const nodeBuf = Buffer.from(buf);
|
||||
const nodeEncBuf = nodeBuf.toString("base64");
|
||||
|
||||
report("Buffer - Base64 encode", benchmark(() =>
|
||||
nodeBuf.toString("base64"), nodeBuf.length));
|
||||
report("Buffer - Base64 decode", benchmark(() =>
|
||||
Buffer.from(nodeEncBuf, "base64"), nodeBuf.length));
|
||||
}
|
||||
Reference in New Issue
Block a user