diff options
author | Loïc Hoguin <[email protected]> | 2018-04-04 13:13:37 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-04-04 13:13:37 +0200 |
commit | d2a3f2cedd7c00d0933222aed9c06b3149aa4db4 (patch) | |
tree | 4f1499bac639c782b250af0fbf0dec2064315813 /articles/erlang-validate-utf8 | |
parent | 1d654719f5fa6be67d2c95145872068665702cb7 (diff) | |
download | ninenines.eu-d2a3f2cedd7c00d0933222aed9c06b3149aa4db4.tar.gz ninenines.eu-d2a3f2cedd7c00d0933222aed9c06b3149aa4db4.tar.bz2 ninenines.eu-d2a3f2cedd7c00d0933222aed9c06b3149aa4db4.zip |
Cowboy 2.3.0
Diffstat (limited to 'articles/erlang-validate-utf8')
-rw-r--r-- | articles/erlang-validate-utf8/index.html | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/articles/erlang-validate-utf8/index.html b/articles/erlang-validate-utf8/index.html index f8efb617..87e6830d 100644 --- a/articles/erlang-validate-utf8/index.html +++ b/articles/erlang-validate-utf8/index.html @@ -7,7 +7,7 @@ <meta name="description" content=""> <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara"> - <meta name="generator" content="Hugo 0.30.2" /> + <meta name="generator" content="Hugo 0.37.1" /> <title>Nine Nines: Validating UTF-8 binaries with Erlang</title> @@ -86,7 +86,7 @@ algorithm named <a href="http://bjoern.hoehrmann.de/utf-8/decoder/dfa/">Flexible and Economical UTF-8 Decoder</a>. This is the C99 implementation:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -126,7 +126,7 @@ uint32_t inline <span style="color: #FF0000">}</span></tt></pre></div></div> <div class="paragraph"><p>And this is the Erlang implementation I came up with:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -165,7 +165,7 @@ calculate the next state. Then, the only thing we needed to be careful about was that tuples are 1-based, and that we need to stop processing the binary when we get the state 1 or when the binary is empty.</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -188,7 +188,7 @@ and <code>State</code>. And by write I mean generate.</p></div> the tuple <code>?UTF8D</code> with its 400 elements, and then ran the following expression (after a bit of trial and error):</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -212,7 +212,7 @@ find a way to reduce its size.</p></div> clause at the end instead reduced the number to about 500, and showed that many clauses were similar:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -226,7 +226,7 @@ http://www.gnu.org/software/src-highlite --> <span style="font-weight: bold"><span style="color: #000000">validate_utf8</span></span>(<span style="color: #990000"><<</span> <span style="color: #993399">7</span>, <span style="color: #009900">Rest</span><span style="color: #990000">/</span><span style="color: #FF6600">bits</span> <span style="color: #990000">>></span>, <span style="color: #993399">0</span>) <span style="color: #990000">-></span> <span style="font-weight: bold"><span style="color: #000000">validate_utf8</span></span>(<span style="color: #009900">Rest</span>, <span style="color: #993399">0</span>);</tt></pre></div></div> <div class="paragraph"><p>But also:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -246,7 +246,7 @@ smaller equivalents, testing that performance was not impacted, and comitting the result.</p></div> <div class="paragraph"><p>The patterns above can be found here in the resulting function:</p></div> <div class="listingblock"> -<div class="content"><!-- Generator: GNU source-highlight 3.1.8 +<div class="content"><!-- Generator: GNU source-highlight by Lorenzo Bettini http://www.lorenzobettini.it http://www.gnu.org/software/src-highlite --> @@ -268,6 +268,10 @@ http://www.gnu.org/software/src-highlite --> <ul id="articles-nav" class="extra_margin"> + <li><a href="https://ninenines.eu/articles/cowboy-2.3.0/">Cowboy 2.3</a></li> + + + <li><a href="https://ninenines.eu/articles/cowboy-2.2.0/">Cowboy 2.2</a></li> |