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

2232997

1970941

5478483

1944089

Addition

244246

292081

650160

227720

Subtraction

220957

196953

1625774

315611

Multiplication

433431

321168

1595688

304069

Division

4462364

4983165

4992819

4986970

Modulo

4803576

5257406

4988844

5081814

x64 Relative Performance

ARM64

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

Comparisons

4115337

2169531

5914108

3725321

Addition

194461

196244

543680

195216

Subtraction

151441

97565

1161677

192729

Multiplication

334847

232518

904461

240980

Division

2403064

1848517

2493904

2431322

Modulo

2235322

2159401

2535438

2321638

ARM64 Relative Performance

S390x

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

Comparisons

5171094

5069329

7457296

5343843

Addition

625328

785936

1286888

670826

Subtraction

667538

356865

2555881

741947

Multiplication

904480

729911

1562062

786829

Division

3758577

2211087

3095993

3940264

Modulo

4218409

2330114

3684163

3849849

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

10310201

14160000

Addition

786499

7379646

Subtraction

907051

7890190

Multiplication

855780

10826565

Division

10254664

24702433

Modulo

10851123

17348307

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

1879694

1894168

5198915

Addition

141120

143877

2846799

Subtraction

157649

156965

3027203

Multiplication

266740

138754

4080611

Division

1387560

1752869

6924406

Modulo

1616895

1908345

6397442

x64 Relative Performance

ARM64

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

Comparisons

991273

391918

2551137

Addition

34519

48953

1243326

Subtraction

34184

36278

1387708

Multiplication

126490

36781

1632232

Division

1128432

1107571

2472959

Modulo

1427629

1310481

2926904

ARM64 Relative Performance

x86_32

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

Comparisons

3832024

3823023

5568151

Addition

232554

197092

3488510

Subtraction

1198377

145823

4011233

Multiplication

2921104

428925

6219931

Division

7174578

7189000

9748526

Modulo

5528639

7028725

9205892

x86_32 Relative Performance

macOS

ARM64 (Apple Silicon)

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

Comparisons

135259

134127

340037

136845

Addition

20399

18575

169575

20429

Subtraction

20156

18983

168041

20875

Multiplication

20654

20860

69443

20651

Division

668004

659823

976248

660963

Modulo

664356

662282

1026487

665474

ARM64 Relative Performance