1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> 4<title>Performance Tests</title> 5<link rel="stylesheet" href="boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="index.html" title="Safe Numerics"> 8<link rel="up" href="index.html" title="Safe Numerics"> 9<link rel="prev" href="checked_integer_arithmetic.html" title="safe_compare<T, U>"> 10<link rel="next" href="rationale.html" title="Rationale and FAQ"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img href="index.html" height="164px" src="pre-boost.jpg" alt="Library Documentation Index"></td> 15<td><h2>Safe Numerics</h2></td> 16</tr></table> 17<div class="spirit-nav"> 18<a accesskey="p" href="checked_integer_arithmetic.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="rationale.html"><img src="images/next.png" alt="Next"></a> 19</div> 20<div class="section"> 21<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 22<a name="safe_numerics.performance_tests"></a>Performance Tests</h2></div></div></div> 23<p>Our goal is to create facilities which make it possible to write 24 programs known to be correct. But we also want programmers to actually use 25 the facilities we provide here. This won't happen if using these 26 facilities impacts performance to a significant degree. Although we've 27 taken precautions to avoid doing this, the only real way to know is to 28 create and run some tests.</p> 29<p>So far we've only run one explicit performance test - 30 <code class="filename"><a href="../../test/test_performance.cpp" target="_top">test_performance.cpp</a></code>. 31 This runs a test from the Boost Multiprecision library to count prime 32 numbers and uses on integer arithmetic. We've run the tests with 33 <code class="computeroutput">unsigned</code> integers and with <code class="computeroutput">safe<unsigned></code> 34 on two different compilers.. No other change was made to the program. We 35 list the results without further comment.</p> 36<pre class="screen">g++ (GCC) 6.2.0 37Testing type unsigned: 38time = 17.6215 39count = 1857858 40Testing type safe<unsigned>: 41time = 22.4226 42count = 1857858 43 44clang-802.0.41 45Testing type unsigned: 46time = 16.9174 47count = 1857858 48Testing type safe<unsigned>: 49time = 36.5166 50count = 1857858 51</pre> 52</div> 53<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 54<td align="left"></td> 55<td align="right"><div class="copyright-footer">Copyright © 2012-2018 Robert Ramey<p><a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">Subject to Boost 56 Software License</a></p> 57</div></td> 58</tr></table> 59<hr> 60<div class="spirit-nav"> 61<a accesskey="p" href="checked_integer_arithmetic.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="index.html"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="rationale.html"><img src="images/next.png" alt="Next"></a> 62</div> 63</body> 64</html> 65