summaryrefslogtreecommitdiff
path: root/00_blog/00040_Haskell/00065_Base64-Encoder
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2019-03-17 18:14:32 +0100
committerMiguel <m.i@gmx.at>2019-03-17 18:14:32 +0100
commit0e4810dcfb132bf276a282e25b8523a4009ae08b (patch)
treedac6dce820f0a35d9ed7ea7676982a0f86fd0edb /00_blog/00040_Haskell/00065_Base64-Encoder
parentad6411e9ec256b03f20b9195e25cb128fe02c628 (diff)
rename blog dir
Diffstat (limited to '00_blog/00040_Haskell/00065_Base64-Encoder')
-rw-r--r--00_blog/00040_Haskell/00065_Base64-Encoder/base64.cast146
-rw-r--r--00_blog/00040_Haskell/00065_Base64-Encoder/index.md21
2 files changed, 167 insertions, 0 deletions
diff --git a/00_blog/00040_Haskell/00065_Base64-Encoder/base64.cast b/00_blog/00040_Haskell/00065_Base64-Encoder/base64.cast
new file mode 100644
index 0000000..b32cd78
--- /dev/null
+++ b/00_blog/00040_Haskell/00065_Base64-Encoder/base64.cast
@@ -0,0 +1,146 @@
+{
+ "env": {
+ "TERM": "screen-256color",
+ "SHELL": "/bin/bash"
+ },
+ "version": 1,
+ "command": null,
+ "title": null,
+ "width": 90,
+ "height": 7,
+ "duration": 26.498611,
+ "stdout": [
+ [
+ 0.018948,
+ "miguel@megaloman:~/git/haskell/base64$ "
+ ],
+ [
+ 0.831467,
+ "cat /tmp/random.bin | pv | ./base64 > /dev/null "
+ ],
+ [
+ 0.269283,
+ "\r\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[17Pecho \"Hello Base64!\" | ./base64"
+ ],
+ [
+ 1.242802,
+ "\r\n"
+ ],
+ [
+ 0.002817,
+ "SGVsbG8gQmFzZTY0IQo=\r\n"
+ ],
+ [
+ 0.000531,
+ "miguel@megaloman:~/git/haskell/base64$ "
+ ],
+ [
+ 0.827791,
+ "echo \"Hello Base64!\" | ./base64"
+ ],
+ [
+ 0.207417,
+ "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bcat /tmp/random.bin | pv | ./base64 > /dev/null "
+ ],
+ [
+ 0.963475,
+ "\r\n"
+ ],
+ [
+ 1.002914,
+ " 434MiB 0:00:01 [ 434MiB/s] [ <=> ]\r"
+ ],
+ [
+ 0.99997,
+ " 876MiB 0:00:02 [ 441MiB/s] [ <=> ]\r"
+ ],
+ [
+ 1.000022,
+ "1.28GiB 0:00:03 [ 439MiB/s] [ <=> ]\r"
+ ],
+ [
+ 1.000032,
+ "1.73GiB 0:00:04 [ 455MiB/s] [ <=> ]\r"
+ ],
+ [
+ 0.999929,
+ "2.18GiB 0:00:05 [ 464MiB/s] [ <=> ]\r"
+ ],
+ [
+ 0.999976,
+ "2.64GiB 0:00:06 [ 464MiB/s] [ <=> ]\r"
+ ],
+ [
+ 1.000019,
+ "3.09GiB 0:00:07 [ 466MiB/s] [ <=> ]\r"
+ ],
+ [
+ 1.00003,
+ "3.55GiB 0:00:08 [ 467MiB/s] [ <=> ]\r"
+ ],
+ [
+ 1.0,
+ "3.99GiB 0:00:09 [ 452MiB/s] [ <=> ]\r"
+ ],
+ [
+ 0.999962,
+ "4.43GiB 0:00:10 [ 451MiB/s] [ <=> ]\r"
+ ],
+ [
+ 1.000027,
+ "4.88GiB 0:00:11 [ 459MiB/s] [ <=> ]\r"
+ ],
+ [
+ 1.000061,
+ "5.32GiB 0:00:12 [ 451MiB/s] [ <=> ]\r"
+ ],
+ [
+ 0.999986,
+ "5.76GiB 0:00:13 [ 449MiB/s] [ <=> ]\r"
+ ],
+ [
+ 0.999944,
+ "6.19GiB 0:00:14 [ 441MiB/s] [ <=> ]\r"
+ ],
+ [
+ 0.999991,
+ "6.64GiB 0:00:15 [ 453MiB/s] [ <=> ]\r"
+ ],
+ [
+ 1.000027,
+ "7.07GiB 0:00:16 [ 442MiB/s] [ <=> ]\r"
+ ],
+ [
+ 1.00001,
+ " 7.5GiB 0:00:17 [ 442MiB/s] [ <=> ]\r"
+ ],
+ [
+ 1.000009,
+ "7.93GiB 0:00:18 [ 440MiB/s] [ <=> ]\r"
+ ],
+ [
+ 0.999988,
+ "8.37GiB 0:00:19 [ 449MiB/s] [ <=> ]\r"
+ ],
+ [
+ 1.000024,
+ "8.81GiB 0:00:20 [ 445MiB/s] [ <=> ]\r"
+ ],
+ [
+ 0.99992,
+ "9.26GiB 0:00:21 [ 461MiB/s] [ <=> ]\r"
+ ],
+ [
+ 1.000016,
+ "9.71GiB 0:00:22 [ 461MiB/s] [ <=> ]\r"
+ ],
+ [
+ 0.129892,
+ "9.77GiB 0:00:22 [ 451MiB/s] [ <=> ]\r\r\n"
+ ],
+ [
+ 0.000604,
+ "miguel@megaloman:~/git/haskell/base64$ "
+ ]
+ ]
+} \ No newline at end of file
diff --git a/00_blog/00040_Haskell/00065_Base64-Encoder/index.md b/00_blog/00040_Haskell/00065_Base64-Encoder/index.md
new file mode 100644
index 0000000..bdbae41
--- /dev/null
+++ b/00_blog/00040_Haskell/00065_Base64-Encoder/index.md
@@ -0,0 +1,21 @@
+ February 2018
+Miguel's Base64 Encoder
+=======================
+
+Initially coded on a cold winter afternoon to fully understand **base64 encoding** and play with
+**Haskell**, which is always an indisputable pleasure. Hacked together in _big anger_, due to my
+friend Nick's fairy tales about saving his encrypted binary data in plain _ASCII_
+configuration files,... featuring strange letters and non-printable characters. :smile:
+
+After optimizing quite a bit, the encoder performs around **460MB/s** on a single core of my _i7-4790K_.
+
+<asciinema-player loop="1" preload="true" theme="solarized-dark" autoplay="true" src="base64.cast"></asciinema-player>
+
+The source code below was auto-fetched from:
+<https://gitweb.softwarefools.com/?p=miguel/haskell.git;a=blob;f=base64/base64.hs>
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines}
+{BEGIN:EMBED}
+https://gitweb.softwarefools.com/?p=miguel/haskell.git;a=blob_plain;f=base64/base64.hs
+{END:EMBED}
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~