-r--r--r-- 15026 lib25519-20230630/doc/html/speed.html raw
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
html{overflow-y:scroll}
body{font-family:"Noto Sans","Droid Sans","DejaVu Sans","Arial",sans-serif;line-height:1.6}
tt,code{font-family:"Noto Sans Mono","Droid Sans Mono","DejaVu Sans Mono","Courier New",monospace,sans-serif;font-size:1em;}
h1{font-size:1.5em}
h2{font-size:1.3em}
h3{font-size:1.0em}
h1 a{text-decoration:none}
table{border-collapse:collapse}
th,td{border:1px solid black}
table a{text-decoration:none}
.links a:hover{text-decoration:underline}
.links a:active{text-decoration:underline}
.links img{width:200px;padding-left:1em}
.links td{border:0px;padding-top:0.5em;padding-bottom:0.5em}
.openssl{color:#004040}
.lib25519{color:#c25519}
.headline{padding:0;font-weight:bold;font-size:1.5em;vertical-align:top;padding-bottom:0.5em;color:#c25519}
.navt{display:inline-block;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;
min-width:16%;margin:0;padding:0;padding-left:0.5em;padding-right:0.5em;vertical-align:center;
font-weight:bold;font-size:1.1em;text-align:center;border:1px solid black}
.here{border-bottom:0px;background-color:#ffffff}
.away{background-color:#c25519;}
.away a{text-decoration:none;display:block;color:#ffffff}
.away a:hover,.away a:active{text-decoration:underline}
.main{margin:0;padding-top:0em;padding-bottom:1%;clear:both}
</style>
<title>
lib25519: Speed</title>
</head>
<body>
<div class=headline>
lib25519</div>
<div class=nav>
<div class="navt away"><a href=index.html>Intro</a>
</div><div class="navt away"><a href=download.html>Download</a>
</div><div class="navt away"><a href=install.html>Install</a>
</div><div class="navt away"><a href=api.html>API</a>
</div><div class="navt away"><a href=x25519-cli.html>X CLI</a>
</div><div class="navt away"><a href=ed25519-cli.html>Ed CLI</a>
</div><div class="navt away"><a href=security.html>Security</a>
</div><div class="navt here">Speed
</div><div class="navt away"><a href=internals.html>Internals</a>
</div><div class="navt away"><a href=people.html>People</a>
</div><div class="navt away"><a href=license.html>License</a>
</div></div>
<div class=main>
<p>In the following speed table, smaller numbers are better.
The numbers are median single-core cycle counts on various microarchitectures.
Overclocking is disabled.</p>
<p>OpenSSL 3.1.1 cycle counts are reported as a baseline for comparison.
For comparability to OpenSSL's speed-testing utility,
the OpenSSL cycle counts omit various OpenSSL overheads; see below for details.
The lib25519 cycle counts include all overheads.
Each library is assigned one color in the table.</p>
<table>
<thead>
<tr>
<th align="left">uarch</th>
<th align="left">software</th>
<th align="right">X key</th>
<th align="right">X dh</th>
<th align="right">X batch</th>
<th align="right">Ed key</th>
<th align="right">Ed sign</th>
<th align="right">Ed verif</th>
<th align="right">Ed MSM</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">Zen 3</td>
<td align="left"><span class=openssl>OpenSSL</span></td>
<td align="right"><span class=openssl>119875</span></td>
<td align="right"><span class=openssl>114972</span></td>
<td align="right"></td>
<td align="right"><span class=openssl>124406</span></td>
<td align="right"><span class=openssl>110711</span></td>
<td align="right"><span class=openssl>370539</span></td>
<td align="right"></td>
</tr>
<tr>
<td align="left"></td>
<td align="left"><span class=lib25519>lib25519</span></td>
<td align="right"><span class=lib25519>26519</span></td>
<td align="right"><span class=lib25519>73086</span></td>
<td align="right"><span class=lib25519>47795</span></td>
<td align="right"><span class=lib25519>27287</span></td>
<td align="right"><span class=lib25519>30659</span></td>
<td align="right"><span class=lib25519>112326</span></td>
<td align="right"><span class=lib25519>41542</td>
</tr>
<tr>
<td align="left">Tiger Lake</td>
<td align="left"><span class=openssl>OpenSSL</span></td>
<td align="right"><span class=openssl>115612</span></td>
<td align="right"><span class=openssl>118735</span></td>
<td align="right"></td>
<td align="right"><span class=openssl>118894</span></td>
<td align="right"><span class=openssl>110714</span></td>
<td align="right"><span class=openssl>370523</span></td>
<td align="right"></td>
</tr>
<tr>
<td align="left"></td>
<td align="left"><span class=lib25519>lib25519</span></td>
<td align="right"><span class=lib25519>26494</span></td>
<td align="right"><span class=lib25519>64627</span></td>
<td align="right"><span class=lib25519>21658</span></td>
<td align="right"><span class=lib25519>27278</span></td>
<td align="right"><span class=lib25519>31373</span></td>
<td align="right"><span class=lib25519>116180</span></td>
<td align="right"><span class=lib25519>39693</td>
</tr>
<tr>
<td align="left">Goldmont</td>
<td align="left"><span class=openssl>OpenSSL</span></td>
<td align="right"><span class=openssl>248978</span></td>
<td align="right"><span class=openssl>273332</span></td>
<td align="right"></td>
<td align="right"><span class=openssl>263920</span></td>
<td align="right"><span class=openssl>226717</span></td>
<td align="right"><span class=openssl>740570</span></td>
<td align="right"></td>
</tr>
<tr>
<td align="left"></td>
<td align="left"><span class=lib25519>lib25519</span></td>
<td align="right"><span class=lib25519>88613</span></td>
<td align="right"><span class=lib25519>286276</span></td>
<td align="right"><span class=lib25519>280821</span></td>
<td align="right"><span class=lib25519>91012</span></td>
<td align="right"><span class=lib25519>100814</span></td>
<td align="right"><span class=lib25519>346731</span></td>
<td align="right"><span class=lib25519>95274</td>
</tr>
<tr>
<td align="left">Skylake</td>
<td align="left"><span class=openssl>OpenSSL</span></td>
<td align="right"><span class=openssl>134236</span></td>
<td align="right"><span class=openssl>118455</span></td>
<td align="right"></td>
<td align="right"><span class=openssl>139969</span></td>
<td align="right"><span class=openssl>125875</span></td>
<td align="right"><span class=openssl>410016</span></td>
<td align="right"></td>
</tr>
<tr>
<td align="left"></td>
<td align="left"><span class=lib25519>lib25519</span></td>
<td align="right"><span class=lib25519>28293</span></td>
<td align="right"><span class=lib25519>88082</span></td>
<td align="right"><span class=lib25519>62417</span></td>
<td align="right"><span class=lib25519>28928</span></td>
<td align="right"><span class=lib25519>32588</span></td>
<td align="right"><span class=lib25519>113410</span></td>
<td align="right"><span class=lib25519>41775</td>
</tr>
<tr>
<td align="left">Airmont</td>
<td align="left"><span class=openssl>OpenSSL</span></td>
<td align="right"><span class=openssl>310990</span></td>
<td align="right"><span class=openssl>618831</span></td>
<td align="right"></td>
<td align="right"><span class=openssl>329070</span></td>
<td align="right"><span class=openssl>276825</span></td>
<td align="right"><span class=openssl>853552</span></td>
<td align="right"></td>
</tr>
<tr>
<td align="left"></td>
<td align="left"><span class=lib25519>lib25519</span></td>
<td align="right"><span class=lib25519>143599</span></td>
<td align="right"><span class=lib25519>449168</span></td>
<td align="right"><span class=lib25519>449232</span></td>
<td align="right"><span class=lib25519>147183</span></td>
<td align="right"><span class=lib25519>162634</span></td>
<td align="right"><span class=lib25519>543339</span></td>
<td align="right"><span class=lib25519>155019</td>
</tr>
<tr>
<td align="left">Broadwell</td>
<td align="left"><span class=openssl>OpenSSL</span></td>
<td align="right"><span class=openssl>128083</span></td>
<td align="right"><span class=openssl>121267</span></td>
<td align="right"></td>
<td align="right"><span class=openssl>133816</span></td>
<td align="right"><span class=openssl>120153</span></td>
<td align="right"><span class=openssl>392282</span></td>
<td align="right"></td>
</tr>
<tr>
<td align="left"></td>
<td align="left"><span class=lib25519>lib25519</span></td>
<td align="right"><span class=lib25519>29669</span></td>
<td align="right"><span class=lib25519>117858</span></td>
<td align="right"><span class=lib25519>72444</span></td>
<td align="right"><span class=lib25519>30654</span></td>
<td align="right"><span class=lib25519>34379</span></td>
<td align="right"><span class=lib25519>122012</span></td>
<td align="right"><span class=lib25519>41516</td>
</tr>
<tr>
<td align="left">Haswell</td>
<td align="left"><span class=openssl>OpenSSL</span></td>
<td align="right"><span class=openssl>174947</span></td>
<td align="right"><span class=openssl>165650</span></td>
<td align="right"></td>
<td align="right"><span class=openssl>180558</span></td>
<td align="right"><span class=openssl>165981</span></td>
<td align="right"><span class=openssl>428332</span></td>
<td align="right"></td>
</tr>
<tr>
<td align="left"></td>
<td align="left"><span class=lib25519>lib25519</span></td>
<td align="right"><span class=lib25519>41449</span></td>
<td align="right"><span class=lib25519>115378</span></td>
<td align="right"><span class=lib25519>76555</span></td>
<td align="right"><span class=lib25519>42339</span></td>
<td align="right"><span class=lib25519>46362</span></td>
<td align="right"><span class=lib25519>160084</span></td>
<td align="right"><span class=lib25519>57325</td>
</tr>
<tr>
<td align="left">Core 2</td>
<td align="left"><span class=openssl>OpenSSL</span></td>
<td align="right"><span class=openssl>302407</span></td>
<td align="right"><span class=openssl>341190</span></td>
<td align="right"></td>
<td align="right"><span class=openssl>311866</span></td>
<td align="right"><span class=openssl>267854</span></td>
<td align="right"><span class=openssl>755291</span></td>
<td align="right"></td>
</tr>
<tr>
<td align="left"></td>
<td align="left"><span class=lib25519>lib25519</span></td>
<td align="right"><span class=lib25519>95106</span></td>
<td align="right"><span class=lib25519>306362</span></td>
<td align="right"><span class=lib25519>306431</span></td>
<td align="right"><span class=lib25519>98459</span></td>
<td align="right"><span class=lib25519>107278</span></td>
<td align="right"><span class=lib25519>363231</span></td>
<td align="right"><span class=lib25519>105382</td>
</tr>
</tbody>
</table>
<p>In the lib25519 distribution,
<code>command/lib25519-speed.c</code> measures lib25519;
<code>speedcomparison/openssl/openssl25519speed.c</code> measures OpenSSL;
<code>benchmarks/*-*</code> is the output of <code>lib25519-speed</code> on various machines;
<code>speedcomparison/openssl/*-*</code> is the output of <code>openssl25519speed</code> on various machines;
and <code>autogen/md-speed</code> extracts the table from those outputs.</p>
<p>Microarchitectures in the table are listed in reverse chronological order of their introduction.
The table reports only median cycle counts;
see the full output files
for differences between multiple measurements and the median.
The table reports the following major operations:</p>
<ul>
<li>
<p>"X key": Generating an X25519 public key and secret key.
This is <code>dh_x25519_keypair selected 32</code> in the <code>lib25519-speed</code> output
(<code>lib25519_dh_keypair</code> in the stable API).</p>
<p>For OpenSSL,
this is <code>x25519-keygen-main</code> in the <code>openssl25519speed</code> output,
measuring the cost of <code>EVP_PKEY_Q_keygen(0,0,"X25519")</code>.
This does not include small OpenSSL overheads for converting the public key and secret key to storage format.</p>
</li>
<li>
<p>"X dh":
Generating an X25519 shared secret.
This is <code>dh_x25519 selected 32</code> in the <code>lib25519-speed</code> output
(<code>lib25519_dh</code> in the stable API).</p>
<p>For OpenSSL,
this is <code>x25519-dh-main</code> in the <code>openssl25519speed</code> output,
measuring the cost of <code>EVP_PKEY_derive</code>
(as in OpenSSL's speed-testing utility).
This does not include the cost of <code>EVP_PKEY_new_raw_public_key</code>
to decode the public key (8376 cycles on Tiger Lake),
<code>EVP_PKEY_CTX_new</code> and <code>EVP_PKEY_derive_init</code> and <code>EVP_PKEY_derive_set_peer</code> for initialization
(together 7660 cycles on Tiger Lake),
and
<code>EVP_PKEY_new_raw_private_key</code> to decode the secret key if it is not decoded already
(113498 cycles on Tiger Lake).</p>
</li>
<li>
<p>"X batch":
Cost <em>per secret</em> of generating 16 separate shared secrets.
This is <code>nPbatch_montgomery25519 selected 16</code> in the <code>lib25519-speed</code> output <em>divided by 16</em>.</p>
</li>
<li>
<p>"Ed key": Generating an Ed25519 public key and secret key.
This is <code>sign_ed25519_keypair selected 32</code> in the <code>lib25519-speed</code> output
(<code>lib25519_sign_keypair</code> in the stable API),</p>
<p>For OpenSSL,
this is <code>ed25519-keygen-main</code> in the <code>openssl25519speed</code> output,
measuring the cost of <code>EVP_PKEY_Q_keygen(0,0,"ED25519")</code>.
This does not include small OpenSSL overheads for converting the public key and secret key to storage format.</p>
</li>
<li>
<p>"Ed sign": Generating an Ed25519 signature of a 59-byte message.
This is <code>sign_ed25519 selected 59</code> in the <code>lib25519-speed</code> output
(<code>lib25519_sign</code> in the stable API).</p>
<p>For OpenSSL,
this is <code>ed25519-sign-main</code> in the <code>openssl25519speed</code> output,
measuring the cost of <code>EVP_DigestSign</code>
(as in OpenSSL's speed-testing utility).
This does not include the cost of
<code>EVP_MD_CTX_new</code> and
<code>EVP_DigestSignInit</code>
(together 6258 cycles on Tiger Lake),
and <code>EVP_PKEY_new_raw_private_key</code> to decode the secret key if it is not decoded already
(116808 cycles on Tiger Lake).</p>
</li>
<li>
<p>"Ed verif": Verifying an Ed25519 signature and recovering a 59-byte message.
This is <code>sign_ed25519_open selected 59</code> in the <code>lib25519-speed</code> output
(<code>lib25519_sign_open</code> in the stable API).</p>
<p>For OpenSSL,
this is <code>ed25519-verify-main</code> in the <code>openssl25519speed</code> output,
measuring the cost of <code>EVP_DigestVerify</code>
(as in OpenSSL's speed-testing utility).
This does not include the cost of
<code>EVP_MD_CTX_new</code> and
<code>EVP_DigestVerifyInit</code>
(together 6054 cycles on Tiger Lake),
and <code>EVP_PKEY_new_raw_public_key</code>
to decode the public key being used for verification
(9560 cycles on Tiger Lake).</p>
</li>
<li>
<p>"Ed MSM": Cost <em>per point</em> of multi-scalar multiplication with 16 points and 16 full-size scalars.
This is <code>multiscalar_ed25519 selected 16</code> in the <code>lib25519-speed</code> output <em>divided by 16</em>.</p>
</li>
</ul><hr><font size=1><b>Version:</b>
This is version 2023.06.30 of the "Speed" web page.
</font>
</div>
</body>
</html>