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

x64 Relative Performance

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

x64 Relative Performance

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

s390x Relative Performance

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

ppc64le Relative Performance

x86_32

This platform has no hardware type so we compare relative to boost::mp::uint128_t
Operation uint128_t boost::mp::uint128_t

Comparisons

9000979

8722814

Addition

898718

9912175

Subtraction

778881

9773677

Multiplication

1778273

8678420

Division

8496503

18133965

Modulo

9081442

11257837

x86 Relative Performance

ARM32

This platform has no hardware type so we compare relative to boost::mp::uint128_t
Operation uint128_t boost::mp::uint128_t

Comparisons

5286033

4538707

Addition

454715

5543856

Subtraction

487190

6465126

Multiplication

1471479

8246098

Division

19868087

32820805

Modulo

20332627

27238658

ARM32 Relative Performance

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

x64 Relative Performance

ARM64

Operation std::_Unsigned128 uint128_t boost::mp::uint128_t

Comparisons

3424403

2062167

5026689

Addition

123659

133084

587373

Subtraction

171721

99453

330052

Multiplication

329287

283443

972009

Division

2044821

1825020

2190856

Modulo

2176318

1897933

2227961

ARM64 Relative Performance

x86_32

Operation std::_Unsigned128 uint128_t boost::mp::uint128_t

Comparisons

4215438

3883846

2852442

Addition

199945

208436

3242910

Subtraction

1206168

210874

3851129

Multiplication

2282869

2680359

5378001

Division

5516964

4328917

6948267

Modulo

4551146

4330152

6294325

x86_32 Relative Performance

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

ARM64 Relative Performance

x86_64

Operation unsigned __int128 uint128_t boost::mp::uint128_t

Comparisons

131902

133564

134182

Addition

20613

17912

40176

Subtraction

20484

18237

40311

Multiplication

20160

20580

43285

Division

686521

699201

945928

Modulo

777084

724648

953117

x64 Relative Performance