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 use 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

2555576

2404372

3576079

2099066

Addition

242772

241336

328546

301186

Subtraction

372481

260064

287267

282908

Multiplication

356366

312736

326328

277284

Division

4481403

4498211

4602586

4290212

Modulo

3965562

4506879

4487023

4247367

x64 Relative Performance

ARM64

Operation unsigned __int128 uint128_t boost::mp::uint128_t absl::uint128

Comparisons

4077924

2335044

5360167

4184235

Addition

137276

151553

184406

151276

Subtraction

155498

133470

186793

149111

Multiplication

218009

233811

324341

293431

Division

2254781

1819447

2211225

2152312

Modulo

2274294

1743274

2324356

2381378

ARM64 Relative Performance

S390x

Operation unsigned __int128 uint128_t boost::mp::uint128_t absl::uint128

Comparisons

7293935

6198402

8182815

13820009

Addition

636224

707436

611849

1530136

Subtraction

572225

350035

595266

1211168

Multiplication

1040424

741789

899957

1843000

Division

4191637

2593472

4106663

4883553

Modulo

4156643

2133029

4398856

5011442

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

9545542

8582001

Addition

686648

7261481

Subtraction

618456

7968678

Multiplication

859253

6746697

Division

8271920

15931092

Modulo

9932867

10242720

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

2055229

1714007

2490543

Addition

152603

116444

2596037

Subtraction

150576

116367

2901567

Multiplication

131223

123694

3300491

Division

1476783

1489919

4898388

Modulo

1421066

1411521

3793762

x64 Relative Performance

ARM64

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

Comparisons

945196

405891

1306884

Addition

37403

40039

1351728

Subtraction

33927

38887

1594845

Multiplication

74384

46406

1281286

Division

992963

790846

2035065

Modulo

1087702

861121

1702396

ARM64 Relative Performance

x86_32

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

Comparisons

4806287

3940703

2624013

Addition

254275

202421

2961566

Subtraction

1322877

207351

3703369

Multiplication

2327500

2312040

4375417

Division

5596877

5629510

6756883

Modulo

4616488

5696116

6409969

x86_32 Relative Performance

macOS

ARM64 (Apple Silicon)

Operation unsigned __int128 uint128_t boost::mp::uint128_t absl::uint128

Comparisons

134425

134742

133107

135182

Addition

20754

18389

20653

20929

Subtraction

20552

18573

20590

20439

Multiplication

20264

20150

20181

20228

Division

685358

740877

913877

718985

Modulo

733080

699666

951657

719500

ARM64 Relative Performance