uint128_t Benchmarks
Methodology
The benchmarks below represent the time in microseconds it takes to perform 20'000'000 operations between two values of random width (e.g. 2x1 words, 1x2 words, etc.).
On most platforms we use the builtin unsigned __int128 as the reference benchmark.
When this is unavailable (such as on 32-bit architectures) we us boost::multiprecision::uint128_t (abbreviated as boost::mp::uint128_t) as it is widely used, and known to be portable.
On MSVC platforms we use as reference std::_Unsigned128 from the header <__msvc_int128.hpp> since this is bundled with their compiler.
Linux
x86_64
| Operation | unsigned __int128 |
uint128_t |
boost::mp::uint128_t |
absl::uint128 |
|---|---|---|---|---|
Comparisons |
785130 |
765065 |
1363581 |
766205 |
Addition |
90260 |
85758 |
89958 |
89255 |
Subtraction |
91143 |
91449 |
91224 |
89716 |
Multiplication |
111803 |
90069 |
113559 |
89660 |
Division |
1058435 |
901516 |
1040071 |
1044710 |
Modulo |
1003366 |
830830 |
1001701 |
978533 |
ARM64
| Operation | unsigned __int128 |
uint128_t |
boost::mp::uint128_t |
absl::uint128 |
|---|---|---|---|---|
Comparisons |
3427201 |
2078586 |
5026689 |
3753922 |
Addition |
194968 |
159662 |
587373 |
194070 |
Subtraction |
193067 |
161903 |
330052 |
140777 |
Multiplication |
263187 |
201333 |
972009 |
244420 |
Division |
2338258 |
2247175 |
2190856 |
2223032 |
Modulo |
2260200 |
2097760 |
2227961 |
2186750 |
S390x
| Operation | unsigned __int128 |
uint128_t |
boost::mp::uint128_t |
absl::uint128 |
|---|---|---|---|---|
Comparisons |
6803419 |
6280326 |
7965082 |
10515929 |
Addition |
546801 |
618774 |
621572 |
1744226 |
Subtraction |
590011 |
359100 |
691515 |
1527622 |
Multiplication |
891753 |
1192196 |
944289 |
1839038 |
Division |
3827125 |
3201674 |
3997037 |
4913142 |
Modulo |
4925696 |
3360251 |
5144403 |
5422155 |
PPC64LE
| Operation | unsigned __int128 |
uint128_t |
boost::mp::uint128_t |
|---|---|---|---|
Comparisons |
5242604 |
4450958 |
5704848 |
Addition |
221776 |
193063 |
847504 |
Subtraction |
222894 |
175259 |
786659 |
Multiplication |
194494 |
192929 |
795187 |
Division |
4821119 |
4896360 |
5344637 |
Modulo |
4955570 |
4273487 |
5407877 |
Windows
x86_64
| Operation | std::_Unsigned128 |
uint128_t |
boost::mp::uint128_t |
|---|---|---|---|
Comparisons |
2060556 |
1921174 |
3009890 |
Addition |
261475 |
106545 |
2710279 |
Subtraction |
178724 |
124181 |
3059187 |
Multiplication |
146063 |
136115 |
3495634 |
Division |
1332838 |
1360295 |
4852899 |
Modulo |
1465138 |
1471169 |
3926336 |
macOS
ARM64 (Apple Silicon)
| Operation | unsigned __int128 |
uint128_t |
boost::mp::uint128_t |
absl::uint128 |
|---|---|---|---|---|
Comparisons |
131902 |
133564 |
134182 |
132366 |
Addition |
20613 |
17912 |
40176 |
20178 |
Subtraction |
20484 |
18237 |
40311 |
20207 |
Multiplication |
20160 |
20580 |
43285 |
20049 |
Division |
686521 |
699201 |
945928 |
672398 |
Modulo |
777084 |
724648 |
953117 |
734229 |