|  | Home | Libraries | People | FAQ | More | 
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.66. Operator +
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 5.89417 (18.4116s) | 6.87256 (47.4698s) | 6.65008 (107.715s) | 6.53801 (256.244s) | 
| mpq_rational | 1 (3.1237s) | 1 (6.90715s) | 1 (16.1975s) | 1 (39.1929s) | 
Table 1.67. Operator +(int)
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 3.62367 (2.46488s) | 4.18291 (2.94603s) | 4.726 (3.74866s) | 6.1388 (5.56817s) | 
| mpq_rational | 1 (0.680215s) | 1 (0.704303s) | 1 (0.7932s) | 1 (0.907046s) | 
Table 1.68. Operator +(unsigned long long)
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 1.1527 (2.6378s) | 1.31751 (3.09863s) | 1.58996 (4.00714s) | 2.15642 (5.75702s) | 
| mpq_rational | 1 (2.28837s) | 1 (2.35189s) | 1 (2.52028s) | 1 (2.66971s) | 
Table 1.69. Operator +=(unsigned long long)
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 1.18436 (2.7059s) | 1.32279 (3.11099s) | 1.61398 (4.05389s) | 2.20048 (5.84623s) | 
| mpq_rational | 1 (2.2847s) | 1 (2.35183s) | 1 (2.51174s) | 1 (2.6568s) | 
Table 1.70. Operator -
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 5.81893 (18.3457s) | 6.82209 (47.1928s) | 6.64143 (107.498s) | 6.51362 (255.137s) | 
| mpq_rational | 1 (3.15277s) | 1 (6.91765s) | 1 (16.1859s) | 1 (39.1698s) | 
Table 1.71. Operator -(int)
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 3.72441 (2.48756s) | 4.27663 (2.98713s) | 4.62109 (3.72114s) | 6.17605 (5.56503s) | 
| mpq_rational | 1 (0.667908s) | 1 (0.698479s) | 1 (0.805252s) | 1 (0.901066s) | 
Table 1.72. Operator -(unsigned long long)
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 1.15627 (2.63239s) | 1.32096 (3.12092s) | 1.61044 (4.00106s) | 2.19378 (5.7644s) | 
| mpq_rational | 1 (2.27663s) | 1 (2.36262s) | 1 (2.48445s) | 1 (2.62761s) | 
Table 1.73. Operator -=(unsigned long long)
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 1.1984 (2.73444s) | 1.34141 (3.15698s) | 1.64159 (4.06997s) | 2.23017 (5.88108s) | 
| mpq_rational | 1 (2.28174s) | 1 (2.35348s) | 1 (2.47929s) | 1 (2.63706s) | 
Table 1.74. Operator *
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 5.4306 (32.5882s) | 6.91805 (89.9436s) | 6.94556 (207.307s) | 6.88704 (492.151s) | 
| mpq_rational | 1 (6.00084s) | 1 (13.0013s) | 1 (29.8475s) | 1 (71.4604s) | 
Table 1.75. Operator *(int)
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 2.12892 (2.51376s) | 2.47245 (3.07841s) | 2.86832 (3.93619s) | 3.94086 (6.02565s) | 
| mpq_rational | 1 (1.18077s) | 1 (1.24508s) | 1 (1.3723s) | 1 (1.52902s) | 
Table 1.76. Operator *(unsigned long long)
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 1.32254 (5.43565s) | 1.56078 (6.73163s) | 1.97701 (9.32522s) | 2.85404 (15.1573s) | 
| mpq_rational | 1 (4.11002s) | 1 (4.313s) | 1 (4.71682s) | 1 (5.31082s) | 
Table 1.77. Operator *=(unsigned long long)
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 6.29806 (58.1188s) | 6.30556 (59.5076s) | 6.3385 (62.1007s) | 6.55345 (67.6905s) | 
| mpq_rational | 1 (9.22804s) | 1 (9.43733s) | 1 (9.79739s) | 1 (10.329s) | 
Table 1.78. Operator /
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 4.4269 (66.8031s) | 6.40103 (173.527s) | 6.32347 (348.193s) | 6.61148 (824.063s) | 
| mpq_rational | 1 (15.0903s) | 1 (27.1093s) | 1 (55.0637s) | 1 (124.641s) | 
Table 1.79. Operator /(int)
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 1.78772 (2.50984s) | 2.10623 (3.10606s) | 2.46986 (3.99358s) | 3.37428 (5.96678s) | 
| mpq_rational | 1 (1.40393s) | 1 (1.4747s) | 1 (1.61693s) | 1 (1.76831s) | 
Table 1.80. Operator /(unsigned long long)
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 1.29695 (5.45454s) | 1.55248 (6.85353s) | 1.93237 (9.28765s) | 2.75211 (14.8541s) | 
| mpq_rational | 1 (4.20568s) | 1 (4.41458s) | 1 (4.80635s) | 1 (5.39734s) | 
Table 1.81. Operator /=(unsigned long long)
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 6.19401 (58.4278s) | 6.20135 (59.643s) | 6.21327 (62.0338s) | 6.40576 (67.6778s) | 
| mpq_rational | 1 (9.43295s) | 1 (9.61774s) | 1 (9.98407s) | 1 (10.5652s) | 
Table 1.82. Operator construct
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 1 (0.00978288s) | 1 (0.0100574s) | 1 (0.0101393s) | 1 (0.0101847s) | 
| mpq_rational | 39.1516 (0.383015s) | 38.3523 (0.385725s) | 37.5812 (0.381048s) | 37.6007 (0.382953s) | 
Table 1.83. Operator construct(unsigned)
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 1 (0.0548151s) | 1 (0.0557542s) | 1 (0.055825s) | 1 (0.0552808s) | 
| mpq_rational | 7.21073 (0.395257s) | 7.1016 (0.395944s) | 7.02046 (0.391917s) | 7.16881 (0.396297s) | 
Table 1.84. Operator construct(unsigned long long)
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 1 (0.0605156s) | 1 (0.0616657s) | 1 (0.0592056s) | 1 (0.0603081s) | 
| mpq_rational | 35.1604 (2.12775s) | 34.7575 (2.14335s) | 35.7232 (2.11502s) | 35.0437 (2.11342s) | 
Table 1.85. Operator str
| Backend | 128 Bits | 256 Bits | 512 Bits | 1024 Bits | 
|---|---|---|---|---|
| cpp_rational | 5.48898 (0.0208949s) | 8.49668 (0.0546688s) | 10.107 (0.121897s) | 10.5339 (0.310584s) | 
| mpq_rational | 1 (0.0038067s) | 1 (0.00643413s) | 1 (0.0120606s) | 1 (0.0294843s) | 
Test code was compiled with Microsoft Visual Studio 2010 with all optimisations turned on (/Ox), and used MPIR-2.3.0 and MPFR-3.0.0. The tests were run on 32-bit Windows Vista machine.