Skip to content

Instantly share code, notes, and snippets.

@n-soda
Last active May 18, 2017 10:35
Show Gist options
  • Save n-soda/259a73de12938782155c53c3371e3346 to your computer and use it in GitHub Desktop.
Save n-soda/259a73de12938782155c53c3371e3346 to your computer and use it in GitHub Desktop.
<HTML lang="en">
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<META http-equiv="Content-Style-Type" content="text/css">
<TITLE>toupper() implementation speed comparison</TITLE>
<STYLE type="text/css">
<!--
table { border-collapse: collapse; }
thead { background:#e0e0e0; }
colgroup.os { background:#f0f0f0; }
colgroup.compiler { background:#f0f0f0; }
colgroup.option { background:#f0f0f0; }
colgroup.speed { background:#fafafa; }
th { border: solid 1px; padding: 0.5em; }
td { border: solid 1px; padding: 0.5em; }
td.d { text-align: right; }
!-->
</STYLE>
</HEAD>
<BODY>
<p>
this is speed comparison of
<a href="https://gist.github.com/NSTomoS/fe1d105d7a92213c7e1ad80b234a9c83">
https://gist.github.com/NSTomoS/fe1d105d7a92213c7e1ad80b234a9c83
</a><br>
via
<a href="https://twitter.com/NSTomoS/status/865089229214236673">
https://twitter.com/NSTomoS/status/865089229214236673
</a>.
</p>
<table>
<colgroup class="os"></colgroup>
<colgroup class="compiler"></colgroup>
<colgroup class="option"></colgroup>
<colgroup class="speed" span="3"></colgroup>
<thead>
<tr>
<th>OS</th>
<th>compiler</th>
<th>option</th>
<th>toupper</th>
<th>toupper if</th>
<th>toupper switch</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="8">NetBSD-7.1/amd64</td>
<td rowspan="4">gcc-6.3.0</td>
<td>-O0</td><td class="d">64781us</td><td class="d">92829us</td><td class="d">88064us</td>
</tr>
<tr> <td>-O1</td><td class="d">16944us</td><td class="d">12267us</td><td class="d">54188us</td> </tr>
<tr> <td>-O2</td><td class="d">0us</td><td class="d">0us</td><td class="d">59609us</td> </tr>
<tr> <td>-O3</td><td class="d">0us</td><td class="d">0us</td><td class="d">17580us</td> </tr>
<tr>
<td rowspan="4">gcc-4.8.5</td>
<td>-O0</td><td class="d">64859us</td><td class="d">93600us</td><td class="d">79601us</td>
</tr>
<tr> <td>-O1</td><td class="d">15505us</td><td class="d">8499us</td><td class="d">77160us</td> </tr>
<tr> <td>-O2</td><td class="d">0us</td><td class="d">0us</td><td class="d">68512us</td> </tr>
<tr> <td>-O3</td><td class="d">0us</td><td class="d">0us</td><td class="d">18176us</td> </tr>
<tr>
<td rowspan="4">CentOS-7.2.1511/x86_64</td>
<td rowspan="4">gcc-4.8.5</td>
<td>-O0</td><td class="d">84034us</td><td class="d">95656us</td><td class="d">86339us</td>
</tr>
<tr> <td>-O1</td><td class="d">14978us</td><td class="d">15306us</td><td class="d">90035us</td> </tr>
<tr> <td>-O2</td><td class="d">0us</td><td class="d">0us</td><td class="d">211411us</td> </tr>
<tr> <td>-O3</td><td class="d">0us</td><td class="d">0us</td><td class="d">16379us</td> </tr>
</tbody>
</table>
<p>
NOTE: These NetBSD-7.1 and CentOS-7.2.1511 are installed on different machines.
</p>
<p>
The -O2 result on CentOS-7.2.1511 is strange, I'm not sure why.
</p>
</BODY>
</HTML>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment