Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit 9c88ccf530.
PrevUpHomeNext

Integer Algorithm Performance

Note that these tests are carefully designed to test performance of the underlying algorithms and not memory allocation or variable copying. As usual, performance results should be taken with a healthy dose of scepticism, and real-world performance may vary widely depending upon the specifics of the program. In each table relative times are given first, with the best performer given a score of 1. Total actual times are given in brackets, measured in seconds for 500000 operations.

Table 1.43. Operator %

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

1.51155 (0.0481508s)

1.60666 (0.0825917s)

1.75956 (0.127209s)

1.87154 (0.171986s)

2.58143 (0.368469s)

1 (0.512768s)

1.42429 (1.03083s)

1 (1.96988s)

cpp_int(fixed)

1 (0.0318553s)

1.2913 (0.0663805s)

1.33672 (0.0966394s)

1.97924 (0.181883s)

       

gmp_int

1.4659 (0.0466966s)

1 (0.0514059s)

1 (0.0722958s)

1 (0.0918952s)

1 (0.142738s)

1 (0.24073s)

1.17701 (0.603534s)

1 (0.723753s)

tommath_int

27.46 (0.874748s)

20.1749 (1.03711s)

17.9774 (1.29969s)

19.0867 (1.75398s)

23.3789 (3.33706s)

26.6546 (6.41658s)

33.4553 (17.1548s)

70.788 (51.233s)


Table 1.44. Operator %(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

1 (0.00790481s)

1.45288 (0.0215141s)

2.71488 (0.065874s)

4.05695 (0.1044s)

6.59285 (0.288068s)

3.58045 (0.429244s)

6.18417 (0.851447s)

1 (1.57951s)

cpp_int(fixed)

2.18748 (0.0172916s)

1.67119 (0.0247468s)

2.83861 (0.0688759s)

4.3186 (0.111133s)

       

gmp_int

1.50165 (0.0118703s)

1 (0.0148079s)

1 (0.024264s)

1 (0.0257336s)

1 (0.0436939s)

1 (0.0571251s)

1 (0.119886s)

1 (0.137682s)

tommath_int

68.9623 (0.545134s)

54.52 (0.807325s)

38.3573 (0.930702s)

53.0833 (1.36603s)

59.6958 (2.60834s)

103.597 (5.91797s)

133.648 (16.0225s)

392.812 (54.083s)


Table 1.45. Operator &

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

2.82137 (0.0101034s)

3.08842 (0.0128886s)

3.46566 (0.018172s)

2.55025 (0.0204051s)

2.97241 (0.0461406s)

1 (0.0440714s)

1 (0.0811524s)

1 (0.146531s)

cpp_int(fixed)

1 (0.00358104s)

1.5374 (0.00641591s)

1.70378 (0.0089337s)

2.40825 (0.019269s)

       

gmp_int

1.10071 (0.00394167s)

1 (0.00417321s)

1 (0.00524347s)

1 (0.00800121s)

1 (0.015523s)

1.04806 (0.0384586s)

2.0133 (0.0887291s)

1.38531 (0.112421s)

tommath_int

2.18066 (0.00780901s)

2.22528 (0.00928657s)

2.15567 (0.0113032s)

3.05906 (0.0244762s)

2.34741 (0.0364387s)

1.50551 (0.0552444s)

2.29355 (0.10108s)

3.0313 (0.245997s)


Table 1.46. Operator &(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

3.24695 (0.0124861s)

1.81002 (0.0114113s)

2.11984 (0.0179186s)

2.56949 (0.0262296s)

3.62157 (0.063826s)

3.95427 (0.0593859s)

4.84754 (0.102968s)

1 (0.168385s)

cpp_int(fixed)

1 (0.0038455s)

1 (0.00630453s)

1 (0.00845281s)

2.20848 (0.0225444s)

       

gmp_int

3.87448 (0.0148993s)

1.50343 (0.00947844s)

1.59793 (0.013507s)

1 (0.0102081s)

1 (0.0176239s)

1 (0.0121449s)

1 (0.0150182s)

1 (0.0212413s)

tommath_int

25.1094 (0.0965583s)

15.7147 (0.0990734s)

9.65097 (0.0815778s)

8.5208 (0.0869813s)

5.74798 (0.101302s)

10.598 (0.128712s)

12.0534 (0.18102s)

13.0183 (0.276527s)


Table 1.47. Operator *

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

12.4201 (0.0145016s)

1.838 (0.0246772s)

2.10406 (0.0631704s)

2.22846 (0.224062s)

2.53789 (0.918685s)

1 (2.65154s)

1 (7.83314s)

1 (26.1836s)

cpp_int(fixed)

1 (0.00116759s)

1.76789 (0.0237359s)

1.58515 (0.047591s)

1.52628 (0.153461s)

       

gmp_int

4.80091 (0.00560549s)

1 (0.0134261s)

1 (0.0300231s)

1 (0.100546s)

1 (0.361988s)

1 (1.11701s)

2.08347 (5.52441s)

1.44767 (11.3398s)

tommath_int

16.9604 (0.0198027s)

2.43157 (0.0326465s)

2.82213 (0.0847288s)

1.67653 (0.168568s)

1.27293 (0.460786s)

1.41678 (1.58255s)

2.69181 (7.13744s)

3.30421 (25.8824s)


Table 1.48. Operator *(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

10.9781 (0.0072726s)

1.52901 (0.00991594s)

3.35266 (0.0194072s)

2.30215 (0.0214459s)

1.95214 (0.047049s)

1 (0.0576663s)

1 (0.0955853s)

1 (0.167493s)

cpp_int(fixed)

1 (0.000662467s)

1 (0.00648519s)

1.52643 (0.0088359s)

2.26708 (0.0211192s)

       

gmp_int

7.14641 (0.00473426s)

1.74133 (0.0112929s)

1 (0.00578859s)

1 (0.00931559s)

1 (0.0241013s)

1.12075 (0.0477494s)

1.96831 (0.113505s)

1.44107 (0.137745s)

tommath_int

156.154 (0.103447s)

14.5292 (0.0942242s)

16.82 (0.0973642s)

11.9029 (0.110883s)

5.61803 (0.135402s)

4.61241 (0.196512s)

5.30415 (0.30587s)

5.73424 (0.548109s)


Table 1.49. Operator *(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

8.98335 (0.00669928s)

1.79861 (0.00820918s)

1.86924 (0.0119122s)

1.71773 (0.0175683s)

2.57826 (0.0539343s)

1 (0.0432066s)

1 (0.0813634s)

1 (0.159452s)

cpp_int(fixed)

1 (0.000745744s)

1.07211 (0.00489332s)

1.19888 (0.00764018s)

1.53618 (0.0157115s)

       

gmp_int

4.97741 (0.00371188s)

1 (0.00456418s)

1 (0.00637276s)

1 (0.0102277s)

1 (0.0209189s)

1 (0.0321931s)

2.05197 (0.0886586s)

1.59261 (0.12958s)

tommath_int

143.938 (0.107341s)

24.0751 (0.109883s)

16.9325 (0.107907s)

11.5473 (0.118102s)

8.08283 (0.169084s)

6.84808 (0.220461s)

8.37134 (0.361697s)

8.20104 (0.667264s)


Table 1.50. Operator *=(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

15.7803 (0.0131299s)

1.67116 (0.00790233s)

1.66661 (0.0119079s)

1.51408 (0.0203561s)

1.23815 (0.0373067s)

1 (0.0424701s)

1 (0.0946934s)

1 (0.177219s)

cpp_int(fixed)

1 (0.000832044s)

1 (0.00472864s)

1 (0.00714494s)

1 (0.0134446s)

       

gmp_int

6.73473 (0.00560359s)

1.81651 (0.00858963s)

1.36813 (0.00977523s)

1.00404 (0.0134989s)

1 (0.0301309s)

1 (0.0457849s)

2.56449 (0.108914s)

2.20384 (0.208689s)

tommath_int

115.266 (0.0959064s)

24.7701 (0.117129s)

15.9941 (0.114277s)

11.3798 (0.152996s)

5.69861 (0.171704s)

5.47882 (0.250847s)

10.6875 (0.453899s)

7.29439 (0.690731s)


Table 1.51. Operator +

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

9.80738 (0.0086037s)

2.34204 (0.0160922s)

1.00627 (0.0131305s)

1.67865 (0.0163002s)

1.88916 (0.033949s)

1 (0.0412289s)

1 (0.083134s)

1 (0.190174s)

cpp_int(fixed)

1 (0.000877268s)

1 (0.00687102s)

1.82016 (0.0237507s)

1.90391 (0.0184876s)

       

gmp_int

5.87168 (0.00515104s)

1.45191 (0.00997612s)

1 (0.0130487s)

1 (0.00971031s)

1 (0.0179704s)

1 (0.0300729s)

1.96754 (0.0811195s)

1.62045 (0.134715s)

tommath_int

13.6707 (0.0119929s)

1.03266 (0.00709542s)

1.02249 (0.0133422s)

1.4749 (0.0143218s)

1.17551 (0.0211244s)

1.08462 (0.0326177s)

1.47125 (0.060658s)

2.75813 (0.229295s)


Table 1.52. Operator +(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

7.65014 (0.00534018s)

1.8992 (0.0063589s)

1.56778 (0.00666443s)

1.29719 (0.00836612s)

1.73231 (0.0204874s)

1 (0.0198385s)

1 (0.0338486s)

1 (0.0760202s)

cpp_int(fixed)

1 (0.000698051s)

1.72665 (0.00578118s)

1.57164 (0.00668085s)

1.90796 (0.0123052s)

       

gmp_int

4.97679 (0.00347405s)

1 (0.0033482s)

1 (0.00425087s)

1 (0.0064494s)

1 (0.0118266s)

1 (0.0195694s)

3.53343 (0.0700979s)

2.28146 (0.0772241s)

tommath_int

127.407 (0.0889366s)

24.8716 (0.0832749s)

20.4864 (0.0870848s)

12.5462 (0.0809152s)

7.07209 (0.083639s)

4.79434 (0.0938225s)

5.93694 (0.11778s)

5.20775 (0.176275s)


Table 1.53. Operator +(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

9.92952 (0.00893714s)

2.68575 (0.0136811s)

1.73024 (0.0102989s)

1.43961 (0.0115471s)

1.46556 (0.0237404s)

1 (0.0253811s)

1 (0.0350422s)

1 (0.0761856s)

cpp_int(fixed)

1 (0.000900057s)

1.27396 (0.00648945s)

1.38787 (0.008261s)

1.56798 (0.0125768s)

       

gmp_int

5.22669 (0.00470432s)

1 (0.00509394s)

1 (0.00595229s)

1 (0.00802101s)

1 (0.0161988s)

1 (0.0174726s)

1.83602 (0.0466003s)

1.90731 (0.0668364s)

tommath_int

100.859 (0.0907784s)

19.2654 (0.0981367s)

14.4537 (0.0860324s)

10.0594 (0.0806864s)

5.71755 (0.0926177s)

6.23483 (0.108939s)

4.63528 (0.117648s)

5.01743 (0.175822s)


Table 1.54. Operator +=(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

12.2366 (0.0106404s)

1.48157 (0.00996803s)

1.58862 (0.0108279s)

2.06658 (0.0131949s)

1.1631 (0.0186902s)

1 (0.0218483s)

1 (0.0394761s)

1 (0.0783171s)

cpp_int(fixed)

1 (0.000869555s)

1.34779 (0.00906799s)

1 (0.00681593s)

1 (0.00638493s)

       

gmp_int

11.3522 (0.00987134s)

1 (0.00672804s)

1.27495 (0.00868995s)

2.42237 (0.0154667s)

1 (0.0160693s)

1.09672 (0.0221405s)

2.61199 (0.0570676s)

2.13093 (0.0841208s)

tommath_int

88.4252 (0.0768906s)

14.139 (0.0951277s)

11.6282 (0.0792569s)

14.5551 (0.0929332s)

6.86867 (0.110375s)

5.67471 (0.11456s)

7.29502 (0.159384s)

5.733 (0.226317s)


Table 1.55. Operator -

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

4.45457 (0.00859678s)

1.28478 (0.013219s)

1.27873 (0.0117779s)

1.43649 (0.0151597s)

2.82516 (0.0507822s)

1 (0.0463464s)

1 (0.0813138s)

1 (0.191562s)

cpp_int(fixed)

1 (0.00192988s)

1 (0.010289s)

1 (0.00921062s)

1.5372 (0.0162226s)

       

gmp_int

3.4436 (0.00664573s)

1.25045 (0.0128659s)

1.10953 (0.0102195s)

1 (0.0105533s)

1 (0.017975s)

1 (0.0321962s)

2.54862 (0.11812s)

1.83623 (0.14931s)

tommath_int

9.3224 (0.0179911s)

1.08796 (0.011194s)

1.93265 (0.017801s)

1.82306 (0.0192393s)

1.55663 (0.0279804s)

1.6544 (0.0532653s)

1.90928 (0.0884881s)

4.41259 (0.358805s)


Table 1.56. Operator -(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

3.07164 (0.00347144s)

1.38957 (0.00531251s)

1.29053 (0.00548206s)

1.35239 (0.00759591s)

1.50007 (0.0176467s)

1 (0.0209158s)

1 (0.0402632s)

1 (0.0674681s)

cpp_int(fixed)

1 (0.00113016s)

1.26281 (0.00482789s)

1.25074 (0.00531307s)

3.3923 (0.0190533s)

       

gmp_int

3.22069 (0.00363988s)

1 (0.00382312s)

1 (0.00424793s)

1 (0.00561665s)

1 (0.0117639s)

1 (0.0225873s)

2.75829 (0.0576919s)

2.03214 (0.0818204s)

tommath_int

81.1433 (0.0917047s)

21.4543 (0.0820224s)

19.3098 (0.0820267s)

16.2994 (0.0915478s)

7.23608 (0.0851246s)

4.48441 (0.101291s)

5.51882 (0.115431s)

4.44737 (0.179066s)


Table 1.57. Operator -(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

7.02787 (0.00807189s)

1.85949 (0.00922027s)

1.40179 (0.00830959s)

1.22546 (0.00988039s)

1.27526 (0.0235442s)

1 (0.0242017s)

1 (0.0317445s)

1 (0.0783054s)

cpp_int(fixed)

1 (0.00114855s)

1.03947 (0.00515424s)

1.22566 (0.00726552s)

1.56568 (0.0126235s)

       

gmp_int

7.54669 (0.00866778s)

1 (0.0049585s)

1 (0.00592785s)

1 (0.00806262s)

1 (0.0184622s)

1 (0.0220616s)

1.79985 (0.0435595s)

2.08427 (0.0661641s)

tommath_int

72.1332 (0.0828488s)

18.985 (0.0941371s)

13.9301 (0.0825755s)

9.93889 (0.0801335s)

5.42256 (0.100113s)

4.58437 (0.101139s)

4.91664 (0.118991s)

5.5407 (0.175887s)


Table 1.58. Operator -=(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

10.8565 (0.0103583s)

2.00541 (0.0102937s)

1.73348 (0.0103591s)

2.53718 (0.0189898s)

1.21308 (0.0265754s)

1 (0.0249248s)

1 (0.0377524s)

1 (0.070851s)

cpp_int(fixed)

1 (0.000954108s)

1 (0.00513296s)

1 (0.00597589s)

1 (0.00748462s)

       

gmp_int

6.6602 (0.00635455s)

1.61345 (0.00828179s)

1.41745 (0.00847054s)

1.41728 (0.0106078s)

1 (0.0219074s)

1 (0.0250737s)

2.12439 (0.05295s)

2.51074 (0.0947863s)

tommath_int

88.858 (0.0847801s)

18.6448 (0.0957029s)

13.7283 (0.0820388s)

13.4423 (0.100611s)

4.83335 (0.105886s)

4.6829 (0.117418s)

7.59449 (0.189292s)

5.86189 (0.2213s)


Table 1.59. Operator /

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

3.20876 (0.0878919s)

3.17469 (0.181536s)

3.14517 (0.250544s)

4.14655 (0.365546s)

4.70812 (0.702366s)

2.28619 (1.18106s)

3.54663 (2.26453s)

1 (4.52755s)

cpp_int(fixed)

1 (0.0273912s)

1.72404 (0.098585s)

2.12584 (0.169344s)

3.71442 (0.327451s)

       

gmp_int

1.70383 (0.04667s)

1 (0.0571824s)

1 (0.0796599s)

1 (0.0881567s)

1 (0.149182s)

1 (0.208719s)

1 (0.516606s)

1 (0.638503s)

tommath_int

40.8044 (1.11768s)

17.2975 (0.989116s)

17.4097 (1.38686s)

20.9668 (1.84837s)

20.6415 (3.07934s)

31.5839 (6.59216s)

33.0087 (17.0525s)

81.0894 (51.7759s)


Table 1.60. Operator /(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

4.50037 (0.0520677s)

6.30243 (0.108097s)

8.34437 (0.193637s)

7.02879 (0.296939s)

6.47793 (0.630264s)

2.64044 (1.08346s)

3.92627 (2.33772s)

1 (4.22641s)

cpp_int(fixed)

1.27227 (0.0147198s)

4.34067 (0.0744498s)

6.08699 (0.141253s)

6.56549 (0.277366s)

       

gmp_int

1 (0.0115696s)

1 (0.0171517s)

1 (0.0232057s)

1 (0.0422461s)

1 (0.0972941s)

1 (0.156597s)

1 (0.410334s)

1 (0.595404s)

tommath_int

60.4712 (0.69963s)

44.8464 (0.769191s)

40.4334 (0.938285s)

35.0752 (1.48179s)

26.8178 (2.60921s)

37.2616 (5.83504s)

37.7146 (15.4756s)

84.1326 (50.0929s)


Table 1.61. Operator /(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

6.09203 (0.0582351s)

6.42997 (0.0982056s)

6.2137 (0.151642s)

6.62408 (0.281298s)

9.30105 (0.706562s)

3.66307 (1.0584s)

4.10257 (2.14867s)

1 (4.2547s)

cpp_int(fixed)

1.76794 (0.0169001s)

3.59379 (0.0548884s)

5.55499 (0.135566s)

6.36274 (0.2702s)

       

gmp_int

1 (0.00955921s)

1 (0.0152731s)

1 (0.0244044s)

1 (0.042466s)

1 (0.0759658s)

1 (0.125208s)

1 (0.288938s)

1 (0.523737s)

tommath_int

63.2738 (0.604848s)

57.3767 (0.876321s)

43.9301 (1.07209s)

40.0122 (1.69916s)

41.1147 (3.12331s)

57.9739 (7.25882s)

68.6676 (19.8407s)

109.312 (57.2509s)


Table 1.62. Operator /=(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

5.21402 (0.0701172s)

4.76442 (0.105309s)

5.1245 (0.171387s)

7.39587 (0.299993s)

6.88568 (0.632889s)

3.2993 (1.05399s)

3.52936 (2.14442s)

1 (4.37618s)

cpp_int(fixed)

1.68246 (0.0226255s)

3.12633 (0.0691018s)

3.98733 (0.133354s)

6.62903 (0.268888s)

       

gmp_int

1 (0.0134478s)

1 (0.0221032s)

1 (0.0334445s)

1 (0.0405622s)

1 (0.0919138s)

1 (0.14699s)

1 (0.319457s)

1 (0.607595s)

tommath_int

46.0731 (0.619583s)

43.6571 (0.964961s)

30.1861 (1.00956s)

41.4936 (1.68307s)

32.6785 (3.0036s)

48.2935 (7.09868s)

64.9093 (20.7357s)

111.801 (67.9296s)


Table 1.63. Operator <<

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

9.93178 (0.0116142s)

1.74005 (0.0147029s)

2.68859 (0.0238748s)

2.04419 (0.0394659s)

2.15112 (0.0859331s)

1 (0.0889652s)

1 (0.190562s)

1 (0.32803s)

cpp_int(fixed)

1 (0.00116939s)

1 (0.00844969s)

1.94851 (0.0173029s)

1.55242 (0.0299716s)

       

gmp_int

4.60815 (0.00538874s)

1.02939 (0.00869801s)

1 (0.00888006s)

1 (0.0193064s)

1 (0.039948s)

1 (0.0597248s)

1.65224 (0.146992s)

1.08567 (0.206887s)

tommath_int

10.7935 (0.0126218s)

2.38166 (0.0201243s)

2.42444 (0.0215291s)

1.87488 (0.0361972s)

1.73489 (0.0693055s)

1.93177 (0.115375s)

2.49667 (0.222116s)

2.82346 (0.538044s)


Table 1.64. Operator >>

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

12.5304 (0.011709s)

6.85524 (0.0153366s)

8.77866 (0.0209131s)

3.21549 (0.0146098s)

4.04361 (0.0183489s)

3.04276 (0.0219967s)

8.19636 (0.0537598s)

1 (0.0745484s)

cpp_int(fixed)

1 (0.000934446s)

6.55349 (0.0146615s)

6.51353 (0.0155169s)

4.90631 (0.0222922s)

       

gmp_int

2.59712 (0.00242687s)

1 (0.0022372s)

1 (0.00238226s)

1 (0.00454358s)

1 (0.00453774s)

1 (0.00313265s)

1 (0.00722919s)

1 (0.00655899s)

tommath_int

102.662 (0.0959319s)

42.5337 (0.0951565s)

39.1437 (0.0932504s)

21.0397 (0.0955953s)

29.6104 (0.134364s)

62.7092 (0.196446s)

49.6167 (0.358689s)

137.105 (0.899272s)


Table 1.65. Operator ^

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

2.8103 (0.0101384s)

4.11932 (0.0282768s)

2.25923 (0.0139063s)

1.94172 (0.0187085s)

1.66067 (0.0405646s)

1 (0.0369865s)

1 (0.0918676s)

1 (0.150955s)

cpp_int(fixed)

1 (0.00360758s)

1 (0.00686442s)

1.50683 (0.00927498s)

1.79076 (0.0172541s)

       

gmp_int

1.35398 (0.0048846s)

1.00969 (0.00693092s)

1 (0.00615531s)

1 (0.00963503s)

1 (0.0244266s)

1 (0.0429561s)

2.17737 (0.0805332s)

1.3521 (0.124214s)

tommath_int

2.28701 (0.00825059s)

1.65996 (0.0113947s)

2.06089 (0.0126854s)

2.03244 (0.0195826s)

1.4173 (0.0346198s)

1.32237 (0.0568037s)

2.69468 (0.0996668s)

2.55626 (0.234837s)


Table 1.66. Operator ^(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

2.67312 (0.00991885s)

1.57246 (0.0115174s)

2.50193 (0.0198209s)

1 (0.0153479s)

1 (0.0264078s)

1 (0.0235546s)

1 (0.0392727s)

1 (0.0657809s)

cpp_int(fixed)

1 (0.00371059s)

1 (0.0073244s)

1 (0.00792226s)

1.04763 (0.0160789s)

       

gmp_int

2.86377 (0.0106263s)

2.18619 (0.0160125s)

2.18777 (0.0173321s)

1.01844 (0.0156309s)

1.13176 (0.0298873s)

1.9665 (0.0406408s)

3.34613 (0.0788165s)

3.54952 (0.139399s)

tommath_int

26.101 (0.0968501s)

14.6444 (0.107261s)

10.0538 (0.079649s)

5.64392 (0.0866224s)

3.8806 (0.102478s)

6.36386 (0.131519s)

8.07216 (0.190136s)

8.01428 (0.314742s)


Table 1.67. Operator construct

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

3.24638 (0.00190752s)

1.06172 (0.00258002s)

1 (0.00248269s)

1 (0.00191598s)

1 (0.00273948s)

1 (0.0017072s)

1 (0.00191549s)

1 (0.0016635s)

cpp_int(fixed)

1 (0.000587582s)

1 (0.00243004s)

1.51116 (0.00375174s)

4.66482 (0.00893771s)

       

gmp_int

5.61558 (0.00329962s)

1.52898 (0.0037155s)

2.51713 (0.00624925s)

1.755 (0.00336255s)

1.40183 (0.00384029s)

1.60131 (0.00385483s)

4.7818 (0.0081635s)

2.07779 (0.00397999s)

tommath_int

251.1 (0.147542s)

63.6186 (0.154596s)

54.6947 (0.13579s)

66.8839 (0.128148s)

47.8098 (0.130974s)

54.8252 (0.13198s)

74.1436 (0.126578s)

83.945 (0.160796s)


Table 1.68. Operator construct(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

2.12644 (0.00192028s)

1 (0.00200418s)

1 (0.00223886s)

1 (0.00189442s)

1 (0.00190833s)

1 (0.00199036s)

1 (0.00200998s)

1 (0.00168004s)

cpp_int(fixed)

1 (0.000903049s)

1.26395 (0.00253319s)

1.78621 (0.00399907s)

5.10701 (0.0096748s)

       

gmp_int

27.1389 (0.0245077s)

10.3593 (0.020762s)

9.02272 (0.0202006s)

9.96334 (0.0188747s)

15.2262 (0.0290565s)

8.50239 (0.0244927s)

35.6564 (0.0709692s)

10.9129 (0.0219346s)

tommath_int

183.484 (0.165695s)

83.0709 (0.166489s)

69.5984 (0.155821s)

75.8903 (0.143768s)

85.5979 (0.163349s)

50.8174 (0.146389s)

70.0602 (0.139445s)

95.4952 (0.191943s)


Table 1.69. Operator construct(unsigned)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

2.00349 (0.00174712s)

1 (0.00225895s)

1 (0.00241092s)

1 (0.00177047s)

1 (0.00304865s)

1 (0.0018378s)

1 (0.0017583s)

1 (0.00197229s)

cpp_int(fixed)

1 (0.000872038s)

1.1805 (0.0026667s)

1.66167 (0.00400614s)

5.54475 (0.00981681s)

       

gmp_int

27.6419 (0.0241048s)

10.0723 (0.0227529s)

7.60577 (0.0183369s)

10.2725 (0.0181871s)

9.38419 (0.0286091s)

9.10394 (0.0220052s)

34.6032 (0.0635939s)

15.7134 (0.0276289s)

tommath_int

207.462 (0.180915s)

84.5379 (0.190967s)

65.2109 (0.157218s)

84.8572 (0.150237s)

47.0682 (0.143494s)

59.4466 (0.143689s)

78.5549 (0.144368s)

103.519 (0.182018s)


Table 1.70. Operator gcd

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

2.10743 (0.358587s)

1.8778 (1.42989s)

2.03859 (3.30534s)

2.01435 (7.01715s)

2.16957 (17.7583s)

1 (32.2572s)

1 (76.6459s)

1 (201.791s)

cpp_int(fixed)

3.65486 (0.621889s)

1.78424 (1.35865s)

2.02664 (3.28597s)

1.95328 (6.8044s)

       

gmp_int

1 (0.170154s)

1 (0.761472s)

1 (1.62139s)

1 (3.48358s)

1 (8.18516s)

1 (18.7879s)

1.82325 (58.8129s)

1.59356 (122.14s)

tommath_int

8.01966 (1.36458s)

4.44226 (3.38266s)

4.55056 (7.37824s)

4.42983 (15.4317s)

5.23788 (42.8729s)

7.25799 (136.362s)

14.6265 (471.81s)

23.1025 (1770.72s)


Table 1.71. Operator powm

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

cpp_int

14.8198 (0.565871s)

13.2096 (2.0199s)

11.8233 (9.06469s)

9.12533 (46.9932s)

cpp_int(fixed)

9.40069 (0.35895s)

10.0395 (1.53516s)

10.5353 (8.07714s)

8.49678 (43.7564s)

gmp_int

1 (0.0381833s)

1 (0.152912s)

1 (0.766677s)

1 (5.14976s)

tommath_int

11.0485 (0.421869s)

8.44037 (1.29063s)

4.18756 (3.21051s)

2.45216 (12.628s)


Table 1.72. Operator str

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

1.47697 (0.000264092s)

2.87174 (0.000644609s)

2.28911 (0.00141073s)

4.92453 (0.00383604s)

5.61647 (0.0137593s)

1.87264 (0.0491109s)

4.29909 (0.171316s)

1 (0.595522s)

cpp_int(fixed)

4.73326 (0.00084634s)

1.78742 (0.000401216s)

1.68455 (0.00103815s)

4.30889 (0.00335647s)

       

gmp_int

1 (0.000178807s)

1 (0.000224466s)

1 (0.00061628s)

1 (0.000778966s)

1 (0.00244981s)

1 (0.00486654s)

1 (0.0262254s)

1 (0.0398493s)

tommath_int

16.7304 (0.00299152s)

26.6015 (0.00597113s)

30.9815 (0.0190933s)

74.7467 (0.0582251s)

82.4773 (0.202054s)

154.996 (0.754295s)

107.534 (2.82013s)

279.178 (11.1251s)


Table 1.73. Operator |

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

2.26845 (0.00991773s)

1.955 (0.00939722s)

2.01122 (0.012635s)

1.76421 (0.0152013s)

1.92162 (0.0293243s)

1 (0.0377549s)

1 (0.0916779s)

1 (0.152323s)

cpp_int(fixed)

1.00452 (0.0043918s)

1.37689 (0.00661838s)

1.3138 (0.00825362s)

1.71906 (0.0148123s)

       

gmp_int

1 (0.00437203s)

1 (0.00480677s)

1 (0.00628228s)

1 (0.00861647s)

1 (0.0152602s)

1.09283 (0.0365187s)

2.43832 (0.0920584s)

1.21204 (0.111118s)

tommath_int

1.69103 (0.00739324s)

1.85402 (0.00891185s)

1.78526 (0.0112155s)

1.86487 (0.0160686s)

1.75184 (0.0267336s)

1.44011 (0.0481236s)

2.33195 (0.0880424s)

2.33204 (0.213797s)


Table 1.74. Operator |(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

2048 Bits

4096 Bits

8192 Bits

16384 Bits

cpp_int

2.11741 (0.00805945s)

2.16753 (0.0119795s)

1.5717 (0.012189s)

1.10016 (0.0134288s)

1.11289 (0.0309032s)

1 (0.0232284s)

1 (0.042441s)

1 (0.0711061s)

cpp_int(fixed)

1 (0.00380628s)

1 (0.00552682s)

1 (0.00775532s)

1 (0.0122062s)

       

gmp_int

2.62934 (0.010008s)

1.86878 (0.0103284s)

3.19589 (0.0247852s)

1.1073 (0.0135159s)

1 (0.0277685s)

1.67609 (0.0360071s)

3.76493 (0.0874534s)

2.72382 (0.115602s)

tommath_int

22.0502 (0.0839291s)

18.6272 (0.102949s)

9.99323 (0.0775007s)

6.28905 (0.0767652s)

3.28821 (0.0913086s)

5.0968 (0.109494s)

6.47865 (0.150489s)

4.8474 (0.205729s)


Table 1.75. Platform Details

Version

Compiler

GNU C++ version 10.3.0

GMP

6.2.0

MPFR

262146

Boost

107800

Run date

Sep 30 2021



PrevUpHomeNext