int128_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 __int128 as the reference benchmark. When this is unavailable (such as on 32-bit architectures) we us boost::multiprecision::int128_t (abbreviated as boost::mp::int128_t) as it is widely used, and known to be portable. On MSVC platforms we use as reference std::_Signed128 from the header <__msvc_int128.hpp> since this is bundled with their compiler.

Linux

x86_64

Operation __int128 int128_t boost::mp::int128_t absl::int128

Comparisons

879535

748787

2210502

741269

Addition

92165

92441

283528

92323

Subtraction

92514

88390

668953

90394

Multiplication

115727

90897

312723

89558

Division

1234838

1352795

1320695

1200439

Modulo

1193529

1256687

1287093

1293439

x64 Relative Performance

ARM64

Operation __int128 int128_t boost::mp::int128_t absl::int128

Comparisons

3495621

2279914

5910287

3749448

Addition

191514

133319

566860

164848

Subtraction

131380

193984

1066509

193467

Multiplication

236071

234594

864526

237676

Division

2412757

2434752

2508755

2484139

Modulo

2501357

2171828

2571959

2158203

x64 Relative Performance

S390x

Operation __int128 int128_t boost::mp::int128_t absl::int128

Comparisons

14099505

12588237

21074294

13972778

Addition

1151086

1374984

3303931

1195725

Subtraction

1223119

753561

4224613

1295929

Multiplication

1904542

2060986

3034387

1733150

Division

8768877

7080113

7306287

7968543

Modulo

8661233

7180650

8801605

8175497

s390x Relative Performance

PPC64LE

Operation __int128 int128_t boost::mp::int128_t

Comparisons

4538094

5796198

13907323

Addition

221708

191841

1177034

Subtraction

222629

174273

1861166

Multiplication

193315

191785

878393

Division

5607581

4669820

5616217

Modulo

5623562

4750314

5641480

ppc64le Relative Performance

x86_32

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

Comparisons

9530060

12168353

Addition

785799

7777469

Subtraction

778881

8214089

Multiplication

1148024

9477355

Division

10337258

22857709

Modulo

10438037

14848256

x86 Relative Performance

ARM32

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

Comparisons

6149439

6432579

Addition

457850

5669571

Subtraction

488321

7464427

Multiplication

1793874

11410321

Division

17738614

38956122

Modulo

18064819

30144743

ARM32 Relative Performance

Windows

x86_64

Operation std::_Signed128 int128_t boost::mp::int128_t

Comparisons

2186843

2142626

4854983

Addition

186771

184598

2645943

Subtraction

193660

186335

2925784

Multiplication

402806

117413

3887479

Division

1612873

2369701

6437280

Modulo

1637135

2218627

6236026

x64 Relative Performance

ARM64

Operation std::_Signed128 int128_t boost::mp::int128_t

Comparisons

911829

368104

2376802

Addition

33233

34001

121700

Subtraction

33411

34130

1488822

Multiplication

117586

56324

1564799

Division

1127267

1500725

2808293

Modulo

1287100

1548073

2997474

ARM64 Relative Performance

x86_32

Operation std::_Signed128 int128_t boost::mp::int128_t

Comparisons

3187340

3046252

4269507

Addition

185960

189165

2488618

Subtraction

979025

192609

2783600

Multiplication

1896082

3569921

4908622

Division

5566403

4348306

6835035

Modulo

4697289

4793845

6476032

x86_32 Relative Performance

macOS

ARM64 (Apple Silicon)

Operation __int128 int128_t boost::mp::int128_t absl::int128

Comparisons

133275

131953

340555

133509

Addition

20203

17797

169909

20208

Subtraction

20203

17832

172497

22199

Multiplication

21496

20202

78269

20364

Division

662767

682891

969277

663602

Modulo

719179

692509

1026090

717897

ARM64 Relative Performance

x86_64

Operation __int128 int128_t boost::mp::int128_t

Comparisons

1628142

1748005

4318109

Addition

224648

180393

925013

Subtraction

212849

131062

1876834

Multiplication

432205

407829

651209

Division

3924951

2409106

3719183

Modulo

3042060

2423738

4443402

x64 Relative Performance