Library Documentation Index

Safe Numerics

PrevUpHomeNext

Performance Tests

Our goal is to create facilities which make it possible to write programs known to be correct. But we also want programmers to actually use the facilities we provide here. This won't happen if using these facilities impacts performance to a significant degree. Although we've taken precautions to avoid doing this, the only real way to know is to create and run some tests.

So far we've only run one explicit performance test - test_performance.cpp. This runs a test from the Boost Multiprecision library to count prime numbers and uses on integer arithmetic. We've run the tests with unsigned integers and with safe<unsigned> on two different compilers.. No other change was made to the program. We list the results without further comment.

g++ (GCC) 6.2.0
Testing type unsigned:
time = 17.6215
count = 1857858
Testing type safe<unsigned>:
time = 22.4226
count = 1857858

clang-802.0.41
Testing type unsigned:
time = 16.9174
count = 1857858
Testing type safe<unsigned>:
time = 36.5166
count = 1857858

PrevUpHomeNext