From 7674e7d0d8286a2ec86982e4e21b66db111e71af Mon Sep 17 00:00:00 2001 From: Kalle Carlbark Date: Sun, 29 Oct 2023 16:36:26 +0100 Subject: [PATCH] docs: Add benchmark --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3bed831..3f30335 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,12 @@ A tool I created to ## Usage ``` Usage: b64 [-e] [-d] - -h, --help Display this help and exit. + -b, --benchmark + Benchmark b64 + -d, --decode Decode base64 to string. @@ -47,10 +49,49 @@ encode this string to base64 $ ``` +### Benchmark +```shell +❯ zig build +❯ ./zig-out/bin/b64 -b +encode + 280335 iterations 12401.51ns per iterations + 40 bytes per iteration + worst: 138209ns median: 10042ns stddev: 318640155486692400.00ns + +decode + 282250 iterations 12048.95ns per iterations + 28 bytes per iteration + worst: 76416ns median: 10125ns stddev: 318604539142680300.00ns + +❯ zig build -Doptimize=ReleaseSafe +❯ ./zig-out/bin/b64 -b +encode + 1284225 iterations 1228755.55ns per iterations + 40 bytes per iteration + worst: 0ns median: 416ns stddev: 86582387.80ns + +decode + 2295809 iterations 1226658.46ns per iterations + 28 bytes per iteration + worst: 0ns median: 375ns stddev: 86582411.15ns + +❯ zig build -Doptimize=ReleaseFast +❯ ./zig-out/bin/b64 -b +encode + 1355137 iterations 93007.39ns per iterations + 40 bytes per iteration + worst: 526709ns median: 83ns stddev: 37608456664387784.00ns + +decode + 2729217 iterations 105389.71ns per iterations + 28 bytes per iteration + worst: 535583ns median: 83ns stddev: 36170163385699460.00ns +``` + ## Build ```shell $ git clone https://git.kcbark.net/zig/b64.git && cd b64 $ zig build -Doptimize=ReleaseFast $ cp zig-out/bin/b64 ~/.local/bin -``` \ No newline at end of file +```