Boost C++ Libraries Home Libraries People FAQ More

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.39. Operator %

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

2.61392 (0.0864932s)

2.33601 (0.180207s)

3.10832 (0.265481s)

4.4334 (0.437939s)

6.58635 (1.84456s)

8.03034 (3.52132s)

cpp_int(fixed)

1 (0.0330895s)

1.41347 (0.10904s)

2.16247 (0.184697s)

3.54449 (0.350131s)

   

gmp_int

1.92882 (0.0638235s)

1 (0.0771433s)

1 (0.0854098s)

1 (0.0987817s)

1 (0.280057s)

1 (0.438501s)

tommath_int

29.1866 (0.96577s)

15.4935 (1.19522s)

17.3239 (1.47963s)

21.5351 (2.12727s)

30.686 (8.59385s)

46.9089 (20.5696s)


Table 1.40. Operator %(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

3.96358 (0.0411513s)

5.50428 (0.0824453s)

9.42287 (0.158338s)

15.8329 (0.324245s)

30.9984 (1.64821s)

45.0524 (3.18758s)

cpp_int(fixed)

1.94108 (0.020153s)

4.67128 (0.0699684s)

7.70602 (0.129488s)

13.4197 (0.274825s)

   

gmp_int

1 (0.0103823s)

1 (0.0149784s)

1 (0.0168035s)

1 (0.0204792s)

1 (0.0531708s)

1 (0.0707528s)

tommath_int

63.4583 (0.658846s)

60.8321 (0.911168s)

71.7106 (1.20499s)

94.0003 (1.92505s)

158.133 (8.40805s)

281.804 (19.9384s)


Table 1.41. Operator &

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

5.80585 (0.0183659s)

2.61424 (0.0152432s)

1.92953 (0.0150612s)

2.06584 (0.0169715s)

2.76807 (0.0908961s)

2.71967 (0.150675s)

cpp_int(fixed)

1 (0.00316334s)

2.07888 (0.0121216s)

1.66677 (0.0130102s)

2.13 (0.0174986s)

   

gmp_int

1.92975 (0.00610446s)

1 (0.00583083s)

1 (0.00780563s)

1 (0.00821528s)

1 (0.0328374s)

1 (0.055402s)

tommath_int

12.8579 (0.0406739s)

7.3359 (0.0427744s)

5.45721 (0.0425969s)

5.59908 (0.0459981s)

2.0162 (0.0662069s)

1.89937 (0.105229s)


Table 1.42. Operator &(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

6.35169 (0.022195s)

1.23274 (0.0225044s)

1.14828 (0.022403s)

1 (0.0249629s)

3.1254 (0.114785s)

5.12161 (0.162092s)

cpp_int(fixed)

1 (0.00349434s)

1 (0.0182556s)

1 (0.0195101s)

1.2174 (0.0303898s)

   

gmp_int

8.90744 (0.0311256s)

1.66139 (0.0303296s)

1.65728 (0.0323335s)

1.22673 (0.0306228s)

1 (0.0367266s)

1 (0.0316487s)

tommath_int

41.7082 (0.145742s)

8.3058 (0.151627s)

7.92746 (0.154665s)

6.17442 (0.154131s)

5.61372 (0.206173s)

7.94642 (0.251494s)


Table 1.43. Operator *

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

31.2488 (0.0300171s)

1.30604 (0.0236033s)

1.54672 (0.0566226s)

1.99827 (0.200935s)

1.86646 (3.97724s)

3.28041 (15.8254s)

cpp_int(fixed)

1 (0.000960586s)

1.05101 (0.0189943s)

1.40113 (0.0512925s)

1.32791 (0.133528s)

   

gmp_int

6.99778 (0.00672197s)

1 (0.0180725s)

1 (0.0366081s)

1 (0.100555s)

1 (2.13089s)

1 (4.82421s)

tommath_int

25.6654 (0.0246539s)

1.93625 (0.0349929s)

1.53585 (0.0562246s)

1.40261 (0.141039s)

1.24172 (2.64598s)

1.99971 (9.64701s)


Table 1.44. Operator *(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

12.9191 (0.00819119s)

1.8286 (0.00975751s)

2.09136 (0.0145601s)

2.10205 (0.0199823s)

1.62628 (0.0692257s)

2.08177 (0.122618s)

cpp_int(fixed)

1 (0.000634036s)

1 (0.00533605s)

1.25356 (0.0087273s)

1.82259 (0.0173257s)

   

gmp_int

9.40263 (0.00596161s)

1.07614 (0.00574233s)

1 (0.00696202s)

1 (0.00950608s)

1 (0.0425668s)

1 (0.0589007s)

tommath_int

186.507 (0.118252s)

23.4915 (0.125352s)

18.6669 (0.129959s)

17.1434 (0.162966s)

6.11737 (0.260397s)

6.03792 (0.355638s)


Table 1.45. Operator *(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

9.1035 (0.00634192s)

1.61555 (0.00682732s)

1.38506 (0.00820436s)

1.28658 (0.012381s)

1.28916 (0.0410419s)

1.44948 (0.0850577s)

cpp_int(fixed)

1 (0.000696646s)

1 (0.00422601s)

1 (0.00592347s)

1.35631 (0.013052s)

   

gmp_int

8.26494 (0.00575774s)

1.31029 (0.00553729s)

1.19721 (0.00709163s)

1 (0.00962312s)

1 (0.0318361s)

1 (0.0586816s)

tommath_int

381.793 (0.265975s)

69.3609 (0.29312s)

50.6122 (0.2998s)

32.8061 (0.315697s)

13.3579 (0.425264s)

10.2399 (0.600894s)


Table 1.46. Operator *=(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

16.5844 (0.0124159s)

1.25396 (0.0117921s)

1.25877 (0.0140258s)

1.25408 (0.017396s)

3.09966 (0.135787s)

2.63342 (0.222949s)

cpp_int(fixed)

1 (0.000748647s)

1 (0.00940387s)

1 (0.0111425s)

1 (0.0138715s)

   

gmp_int

13.2789 (0.00994121s)

1.10899 (0.0104288s)

1.05822 (0.0117912s)

1.01821 (0.0141241s)

1 (0.043807s)

1 (0.0846612s)

tommath_int

382.992 (0.286726s)

30.337 (0.285285s)

29.1674 (0.324997s)

31.5038 (0.437006s)

10.9188 (0.478321s)

15.7365 (1.33227s)


Table 1.47. Operator +

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

15.9318 (0.013332s)

2.10124 (0.0143298s)

2.20691 (0.0167551s)

2.35301 (0.0233641s)

1.33275 (0.0544877s)

2.16492 (0.108428s)

cpp_int(fixed)

1 (0.000836815s)

1 (0.00681969s)

1.41379 (0.0107337s)

2.07286 (0.0205823s)

   

gmp_int

7.69219 (0.00643694s)

1.1551 (0.00787741s)

1 (0.00759213s)

1 (0.00992945s)

1.23736 (0.050588s)

1 (0.0500843s)

tommath_int

8.11368 (0.00678965s)

1.17124 (0.00798749s)

1.38788 (0.0105369s)

1.62714 (0.0161566s)

1 (0.0408838s)

1.74073 (0.0871834s)


Table 1.48. Operator +(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

12.8717 (0.00838402s)

2.30046 (0.00932673s)

2.45998 (0.00974958s)

1.81876 (0.0103926s)

1 (0.0217559s)

1.1339 (0.0382453s)

cpp_int(fixed)

1 (0.000651354s)

2.26453 (0.00918106s)

2.24994 (0.00891717s)

2.34592 (0.0134049s)

   

gmp_int

5.64809 (0.00367891s)

1 (0.00405429s)

1 (0.00396328s)

1 (0.00571412s)

1.34135 (0.0291824s)

1 (0.033729s)

tommath_int

163.863 (0.106733s)

27.8217 (0.112797s)

28.2173 (0.111833s)

24.3745 (0.139279s)

6.8073 (0.148099s)

5.34674 (0.18034s)


Table 1.49. Operator +(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

10.1497 (0.00642975s)

1.57663 (0.00645253s)

1.42461 (0.00641131s)

1.47836 (0.00821865s)

1.25785 (0.0236995s)

1.1786 (0.0416466s)

cpp_int(fixed)

1 (0.00063349s)

2.25723 (0.00923798s)

2.14091 (0.00963492s)

2.49596 (0.0138758s)

   

gmp_int

6.32948 (0.00400966s)

1 (0.00409262s)

1 (0.00450039s)

1 (0.0055593s)

1 (0.0188413s)

1 (0.0353357s)

tommath_int

401.541 (0.254372s)

67.4121 (0.275892s)

62.2763 (0.280267s)

53.4937 (0.297388s)

16.2934 (0.306988s)

10.8628 (0.383846s)


Table 1.50. Operator +=(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

20.6678 (0.0119696s)

1.49971 (0.0116516s)

1.42955 (0.0113839s)

1.45605 (0.0125775s)

2.06272 (0.0473177s)

1.40574 (0.0700083s)

cpp_int(fixed)

1 (0.000579142s)

1 (0.00776928s)

1 (0.00796329s)

1 (0.00863808s)

   

gmp_int

13.7619 (0.00797012s)

1.0168 (0.00789978s)

1.01968 (0.00812s)

1.05837 (0.00914227s)

1 (0.0229395s)

1 (0.0498017s)

tommath_int

445.395 (0.257947s)

35.5299 (0.276042s)

34.9701 (0.278477s)

64.4794 (0.556978s)

14.0169 (0.32154s)

17.3947 (0.866288s)


Table 1.51. Operator -

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

12.3892 (0.013267s)

1.54334 (0.0143848s)

1.75333 (0.0168786s)

2.27597 (0.0248697s)

1.33198 (0.0615975s)

2.25424 (0.124313s)

cpp_int(fixed)

1 (0.00107085s)

1 (0.00932056s)

1.17586 (0.0113195s)

1.94907 (0.0212976s)

   

gmp_int

8.69616 (0.00931231s)

1.01107 (0.00942373s)

1 (0.00962656s)

1 (0.0109271s)

1 (0.0462452s)

1 (0.0551462s)

tommath_int

11.546 (0.0123641s)

1.60814 (0.0149887s)

1.63067 (0.0156977s)

1.69241 (0.018493s)

1.13529 (0.0525017s)

1.80318 (0.0994384s)


Table 1.52. Operator -(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

7.3164 (0.00718041s)

1.97509 (0.00764735s)

1.99047 (0.00793413s)

1.70452 (0.00889396s)

1 (0.0198067s)

1.04883 (0.0351681s)

cpp_int(fixed)

1 (0.000981414s)

2.01105 (0.00778659s)

1.99052 (0.0079343s)

2.35869 (0.0123073s)

   

gmp_int

3.83069 (0.00375949s)

1 (0.00387191s)

1 (0.00398606s)

1 (0.00521786s)

1.56189 (0.0309358s)

1 (0.0335308s)

tommath_int

115.787 (0.113635s)

29.9688 (0.116037s)

28.9647 (0.115455s)

27.5319 (0.143658s)

7.75868 (0.153674s)

5.42319 (0.181844s)


Table 1.53. Operator -(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

7.7478 (0.00750847s)

1.95546 (0.00771183s)

1.80328 (0.00832029s)

1.56695 (0.00851748s)

1.11271 (0.0205857s)

1.19378 (0.0402243s)

cpp_int(fixed)

1 (0.00096911s)

2.13061 (0.00840261s)

1.91132 (0.00881879s)

2.37174 (0.0128921s)

   

gmp_int

4.80618 (0.00465772s)

1 (0.00394375s)

1 (0.00461397s)

1 (0.00543571s)

1 (0.0185005s)

1 (0.0336949s)

tommath_int

267.937 (0.259661s)

71.5531 (0.282188s)

60.4257 (0.278803s)

53.979 (0.293414s)

17.7584 (0.32854s)

10.8218 (0.364638s)


Table 1.54. Operator -=(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

16.3509 (0.0131613s)

1.83102 (0.0134809s)

1.68407 (0.0129795s)

1.64352 (0.0140383s)

2.37302 (0.051436s)

1.47693 (0.0544701s)

cpp_int(fixed)

1 (0.000804926s)

1 (0.00736247s)

1 (0.00770724s)

1 (0.0085416s)

   

gmp_int

10.0648 (0.0081014s)

1.09612 (0.00807013s)

1.09758 (0.00845934s)

1.10598 (0.00944683s)

1 (0.0216753s)

1 (0.0368808s)

tommath_int

319.944 (0.257531s)

37.1214 (0.273305s)

38.1176 (0.293781s)

66.8689 (0.571167s)

15.141 (0.328186s)

22.6158 (0.834089s)


Table 1.55. Operator /

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

3.7053 (0.120457s)

2.31282 (0.256283s)

2.98148 (0.342198s)

4.15769 (0.552845s)

5.66579 (1.93033s)

9.54675 (3.77425s)

cpp_int(fixed)

1 (0.0325094s)

1.01212 (0.112153s)

1.63455 (0.187605s)

2.67551 (0.355761s)

   

gmp_int

2.62651 (0.0853863s)

1 (0.11081s)

1 (0.114775s)

1 (0.132969s)

1 (0.340699s)

1 (0.395344s)

tommath_int

30.2016 (0.981836s)

10.7299 (1.18898s)

12.8954 (1.48007s)

16.5608 (2.20208s)

25.7963 (8.78879s)

53.4042 (21.113s)


Table 1.56. Operator /(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

5.43796 (0.0610196s)

8.7229 (0.114124s)

9.80894 (0.188141s)

10.9464 (0.347422s)

8.94304 (1.5446s)

11.4148 (3.04214s)

cpp_int(fixed)

1.66282 (0.0186586s)

5.28422 (0.0691348s)

6.70321 (0.128571s)

8.47034 (0.268837s)

   

gmp_int

1 (0.0112211s)

1 (0.0130833s)

1 (0.0191805s)

1 (0.0317386s)

1 (0.172715s)

1 (0.266509s)

tommath_int

65.6123 (0.736239s)

74.4427 (0.973953s)

64.7215 (1.24139s)

60.0008 (1.90434s)

47.3896 (8.18491s)

73.3451 (19.5472s)


Table 1.57. Operator /(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

5.69361 (0.0679437s)

8.63227 (0.118515s)

10.4819 (0.19782s)

11.652 (0.36737s)

12.6501 (1.71211s)

12.4658 (3.49901s)

cpp_int(fixed)

1.71873 (0.0205101s)

5.54771 (0.0761662s)

7.87722 (0.148664s)

9.73978 (0.307082s)

   

gmp_int

1 (0.0119333s)

1 (0.0137293s)

1 (0.0188726s)

1 (0.0315286s)

1 (0.135343s)

1 (0.28069s)

tommath_int

70.3948 (0.840045s)

73.9467 (1.01524s)

78.9032 (1.48911s)

74.5804 (2.35142s)

69.6519 (9.42692s)

104.536 (29.3423s)


Table 1.58. Operator /=(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

4.81054 (0.0787575s)

8.57398 (0.16217s)

10.886 (0.247055s)

11.2718 (0.405759s)

12.5937 (1.88874s)

12.21 (3.63347s)

cpp_int(fixed)

1.20166 (0.0196733s)

4.32475 (0.0817993s)

6.58644 (0.149478s)

8.32497 (0.29968s)

   

gmp_int

1 (0.0163719s)

1 (0.0189142s)

1 (0.0226949s)

1 (0.0359977s)

1 (0.149975s)

1 (0.297582s)

tommath_int

53.9084 (0.88258s)

53.1273 (1.00486s)

71.1404 (1.61452s)

67.5031 (2.42996s)

65.7108 (9.85499s)

101.244 (30.1285s)


Table 1.59. Operator <<

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

19.177 (0.0162764s)

2.61717 (0.0163378s)

2.37674 (0.021464s)

2.09019 (0.0286746s)

2.56897 (0.164462s)

2.63407 (0.258076s)

cpp_int(fixed)

1 (0.000848746s)

1 (0.00624253s)

1 (0.00903085s)

1 (0.0137187s)

   

gmp_int

13.6905 (0.0116198s)

1.91174 (0.0119341s)

1.66888 (0.0150714s)

1.41131 (0.0193613s)

1 (0.0640186s)

1 (0.0979761s)

tommath_int

24.7233 (0.0209838s)

4.59302 (0.028672s)

3.68238 (0.033255s)

2.98058 (0.0408897s)

1.84398 (0.118049s)

2.21298 (0.216819s)


Table 1.60. Operator >>

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

20.232 (0.0162325s)

4.69783 (0.0157363s)

4.50992 (0.0149173s)

4.86912 (0.0162095s)

13.239 (0.0539071s)

12.1827 (0.0524954s)

cpp_int(fixed)

1 (0.000802316s)

1.58991 (0.00532573s)

2.13899 (0.00707508s)

4.21178 (0.0140212s)

   

gmp_int

4.29127 (0.00344295s)

1 (0.0033497s)

1 (0.00330767s)

1 (0.00332904s)

1 (0.00407185s)

1 (0.00430902s)

tommath_int

67.6824 (0.0543026s)

17.5897 (0.05892s)

17.6963 (0.0585334s)

17.7611 (0.0591272s)

40.2804 (0.164016s)

45.6107 (0.196537s)


Table 1.61. Operator ^

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

5.21469 (0.0176691s)

1.76461 (0.0151583s)

1.54944 (0.01576s)

1.66733 (0.0166044s)

2.67895 (0.0907825s)

2.85374 (0.147776s)

cpp_int(fixed)

1 (0.00338833s)

1.61335 (0.013859s)

1.5785 (0.0160556s)

1.8238 (0.0181626s)

   

gmp_int

2.65843 (0.00900763s)

1 (0.00859017s)

1 (0.0101714s)

1 (0.00995865s)

1 (0.0338873s)

1 (0.0517833s)

tommath_int

11.7662 (0.0398677s)

4.97263 (0.0427158s)

4.173 (0.0424452s)

4.36742 (0.0434936s)

1.87208 (0.0634399s)

2.15704 (0.111699s)


Table 1.62. Operator ^(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

4.47727 (0.0154762s)

1.1548 (0.0152722s)

1.29522 (0.0149375s)

1 (0.0152534s)

1.16178 (0.062951s)

1 (0.0542065s)

cpp_int(fixed)

1 (0.00345661s)

1 (0.013225s)

1 (0.0115328s)

1.35474 (0.0206643s)

   

gmp_int

9.96342 (0.0344397s)

2.54169 (0.0336138s)

3.0636 (0.0353319s)

2.2878 (0.0348967s)

1 (0.0541849s)

1.14922 (0.0622954s)

tommath_int

39.5678 (0.136771s)

11.1605 (0.147598s)

12.3859 (0.142844s)

9.57606 (0.146067s)

3.32237 (0.180022s)

3.89337 (0.211046s)


Table 1.63. Operator construct

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

2.70048 (0.00154337s)

1 (0.00165673s)

1 (0.00160871s)

1 (0.00172862s)

1 (0.00156009s)

1 (0.00174205s)

cpp_int(fixed)

1 (0.000571519s)

1.23543 (0.00204677s)

1.9796 (0.00318462s)

4.48025 (0.00774465s)

   

gmp_int

85.6322 (0.0489404s)

29.2571 (0.0484711s)

30.662 (0.0493265s)

27.83 (0.0481075s)

40.363 (0.0629698s)

27.9451 (0.048682s)

tommath_int

201.724 (0.115289s)

58.7441 (0.0973229s)

52.7386 (0.0848414s)

44.5608 (0.0770287s)

50.8452 (0.079323s)

47.1258 (0.0820957s)


Table 1.64. Operator construct(unsigned long long)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

2.39475 (0.00192516s)

1 (0.00189599s)

1 (0.00183399s)

1 (0.00196715s)

1 (0.00191441s)

1 (0.0018252s)

cpp_int(fixed)

1 (0.000803908s)

1.19809 (0.00227157s)

1.88086 (0.00344948s)

3.8843 (0.007641s)

   

gmp_int

65.7819 (0.0528826s)

27.1474 (0.0514712s)

29.3096 (0.0537536s)

26.2945 (0.0517252s)

72.2795 (0.138372s)

27.9893 (0.0510862s)

tommath_int

434.327 (0.349159s)

188.668 (0.357713s)

186.415 (0.341884s)

173.347 (0.341s)

183.361 (0.351027s)

175.369 (0.320084s)


Table 1.65. Operator construct(unsigned)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

2.14911 (0.00163907s)

1 (0.00163286s)

1 (0.00171255s)

1 (0.0017176s)

1 (0.00167292s)

1 (0.00156985s)

cpp_int(fixed)

1 (0.000762672s)

1.36862 (0.00223478s)

2.03741 (0.00348916s)

4.53966 (0.00779734s)

   

gmp_int

68.2442 (0.0520479s)

31.4026 (0.0512762s)

30.7091 (0.0525909s)

30.032 (0.0515831s)

41.5223 (0.0694635s)

32.5392 (0.0510816s)

tommath_int

331.014 (0.252455s)

151.468 (0.247326s)

132.724 (0.227296s)

128.015 (0.219878s)

131.833 (0.220546s)

143.372 (0.225072s)


Table 1.66. Operator gcd

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

2.07031 (0.395833s)

3.50598 (2.95518s)

4.44198 (8.63567s)

5.59809 (22.6997s)

9.49572 (269.4s)

15.722 (962.995s)

cpp_int(fixed)

3.47569 (0.664533s)

1.70521 (1.43732s)

2.31892 (4.50823s)

3.55661 (14.4217s)

   

gmp_int

1 (0.191195s)

1 (0.842898s)

1 (1.9441s)

1 (4.0549s)

1 (28.3707s)

1 (61.2516s)

tommath_int

10.8111 (2.06703s)

5.12095 (4.31644s)

4.59174 (8.92681s)

5.01043 (20.3168s)

7.52621 (213.524s)

12.3495 (756.428s)


Table 1.67. Operator powm

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

cpp_int

10.6592 (0.802191s)

13.9407 (2.61537s)

12.912 (10.4205s)

10.8568 (51.2302s)

cpp_int(fixed)

5.82971 (0.438734s)

8.89247 (1.66829s)

9.93013 (8.01404s)

8.83073 (41.6696s)

gmp_int

1 (0.0752583s)

1 (0.187607s)

1 (0.807043s)

1 (4.7187s)

tommath_int

6.1085 (0.459715s)

5.83038 (1.09382s)

3.80545 (3.07116s)

3.02859 (14.291s)


Table 1.68. Operator str

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

1.92305 (0.000421266s)

3.20633 (0.000851021s)

3.65142 (0.00169768s)

5.16642 (0.00504001s)

11.2543 (0.0811042s)

20.2913 (0.313789s)

cpp_int(fixed)

5.11756 (0.00112106s)

1.92296 (0.00051039s)

2.45213 (0.00114008s)

3.72073 (0.00362969s)

   

gmp_int

1 (0.000219061s)

1 (0.000265419s)

1 (0.000464936s)

1 (0.000975531s)

1 (0.00720651s)

1 (0.0154642s)

tommath_int

21.587 (0.00472888s)

39.7234 (0.0105433s)

55.2128 (0.0256704s)

81.4207 (0.0794284s)

169.04 (1.21819s)

302.626 (4.67986s)


Table 1.69. Operator |

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

5.25873 (0.0172824s)

1.96305 (0.0151621s)

1.75036 (0.015208s)

1.87423 (0.017812s)

2.78566 (0.0913325s)

2.88264 (0.14832s)

cpp_int(fixed)

1 (0.00328643s)

1.45652 (0.0112498s)

1.45925 (0.0126787s)

1.95487 (0.0185784s)

   

gmp_int

2.49444 (0.00819781s)

1 (0.00772371s)

1 (0.00868852s)

1 (0.00950363s)

1 (0.0327866s)

1 (0.0514528s)

tommath_int

11.7763 (0.038702s)

5.50066 (0.0424855s)

4.90757 (0.0426395s)

4.5757 (0.0434857s)

1.88223 (0.061712s)

2.0004 (0.102926s)


Table 1.70. Operator |(int)

Backend

128 Bits

256 Bits

512 Bits

1024 Bits

5120 Bits

10240 Bits

cpp_int

4.53358 (0.0155813s)

1.37758 (0.015007s)

1.27482 (0.0145389s)

1 (0.0155149s)

1.17798 (0.0620504s)

1 (0.0526689s)

cpp_int(fixed)

1 (0.00343686s)

1 (0.0108938s)

1 (0.0114047s)

1.3214 (0.0205014s)

   

gmp_int

9.60058 (0.0329958s)

3.00706 (0.0327581s)

3.05453 (0.034836s)

2.20715 (0.0342437s)

1 (0.0526751s)

1.17671 (0.0619762s)

tommath_int

39.7055 (0.136462s)

13.0365 (0.142016s)

14.0596 (0.160345s)

9.31086 (0.144457s)

3.38341 (0.178221s)

3.81403 (0.200881s)


Table 1.71. Platform Details

Platform

Linux 5.3.0-24-generic, version #26-Ubuntu SMP Thu Nov 14 01:33:18 UTC 2019, x86_64

Compiler

GNU C++ version 9.2.1 20191008

GMP

6.1.2

MPFR

262146

Boost

107200

Run date

Dec 13 2019



PrevUpHomeNext