Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/random/random-performance.html @ 20

Last change on this file since 20 was 12, checked in by landauf, 18 years ago

added boost

File size: 3.5 KB
Line 
1<html>
2
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5<title>Boost Random Number Library Performance</title>
6</head>
7
8<body bgcolor="#FFFFFF" text="#000000">
9
10<h1>Random Number Library Performance</h1>
11
12For some people, performance of random number generation is an
13important consideration when choosing a random number generator or a
14particular distribution function.  This page provides numerous
15performance tests with the wide variety of generators and
16distributions available in the boost library.
17<p>
18The performance has been evaluated on a Pentium Pro 200 MHz with gcc
192.95.2, Linux 2.2.13, glibc 2.1.2.  The speed is reported in million
20random numbers per second (M rn/sec), generated in a tight loop.
21<p>
22
23
24<h2>Basic Generators</h2>
25
26<table border="1">
27
28<tr>
29<th>generator</th>
30<th>M rn/sec</th>
31<th>time per random number [usec]</th>
32<th>relative speed compared to fastest [percent]</th>
33</tr>
34
35<tr>
36<td>rand48</td>
37<td>5.38</td>
38<td>0.183</td>
39<td>61%</td>
40</tr>
41
42<tr>
43<td>rand48 run-time configurable</td>
44<td>1.48</td>
45<td>0.677</td>
46<td>17%</td>
47</tr>
48
49<tr>
50<td>lrand48 glibc 2.1.2</td>
51<td>1.19</td>
52<td>0.843</td>
53<td>13%</td>
54</tr>
55
56<tr>
57<td>minstd_rand</td>
58<td>2.39</td>
59<td>0.318</td>
60<td>35%</td>
61</tr>
62
63<tr>
64<td>ecuyer1988</td>
65<td>1.12</td>
66<td>0.892</td>
67<td>13%</td>
68</tr>
69
70<tr>
71<td>kreutzer1986</td>
72<td>3.87</td>
73<td>0.258</td>
74<td>43%</td>
75</tr>
76
77<tr>
78<td>hellekalek1995 (inversive)</td>
79<td>0.20</td>
80<td>5.12</td>
81<td>2%</td>
82</tr>
83
84<tr>
85<td>mt11213b</td>
86<td>6.07</td>
87<td>0.165</td>
88<td>68%</td>
89</tr>
90
91<tr>
92<td>mt19937</td>
93<td>6.06</td>
94<td>0.165</td>
95<td>68%</td>
96</tr>
97
98<tr>
99<td>mt19937 original</td>
100<td>5.33</td>
101<td>0.188</td>
102<td>60%</td>
103</tr>
104
105<tr>
106<td>lagged_fibonacci607</td>
107<td>8.90</td>
108<td>0.112</td>
109<td>100%</td>
110</tr>
111
112<tr>
113<td>lagged_fibonacci4423</td>
114<td>8.54</td>
115<td>0.117</td>
116<td>96%</td>
117</tr>
118
119<tr>
120<td>lagged_fibonacci19937</td>
121<td>7.49</td>
122<td>0.133</td>
123<td>84%</td>
124</tr>
125
126<tr>
127<td>lagged_fibonacci23209</td>
128<td>6.63</td>
129<td>0.151</td>
130<td>74%</td>
131</tr>
132
133<tr>
134<td>lagged_fibonacci44497</td>
135<td>4.01</td>
136<td>0.250</td>
137<td>45%</td>
138</tr>
139
140</table>
141<p>
142Note that the lagged Fibonacci generators produce floating-point
143numbers, whereas all others produce integers.
144
145<h2>Distributions</h2>
146
147<table border="1">
148
149<tr>
150<th>[M rn/sec]</th>
151<th>minstd_rand</th>
152<th>kreutzer1986</th>
153<th>mt19937</th>
154<th>lagged_fibonacci607</th>
155</tr>
156
157<tr>
158<th>uniform_smallint</th>
159<td>1.26</td>
160<td>1.55</td>
161<td>1.93</td>
162<td>-</td>
163</tr>
164
165<tr>
166<th>uniform_01</th>
167<td>1.79</td>
168<td>1.88</td>
169<td>3.03</td>
170<td>7.74</td>
171</tr>
172
173<tr>
174<th>uniform_real</th>
175<td>1.74</td>
176<td>1.56</td>
177<td>2.34</td>
178<td>6.62</td>
179</tr>
180
181<tr>
182<th>geometric</th>
183<td>0.593</td>
184<td>0.629</td>
185<td>0.753</td>
186<td>0.916</td>
187</tr>
188
189<tr>
190<th>triangle</th>
191<td>0.97</td>
192<td>1.02</td>
193<td>1.35</td>
194<td>1.31</td>
195</tr>
196
197<tr>
198<th>exponential</th>
199<td>0.849</td>
200<td>0.828</td>
201<td>0.887</td>
202<td>1.53</td>
203</tr>
204
205<tr>
206<th>normal (polar method)</th>
207<td>0.608</td>
208<td>0.626</td>
209<td>0.738</td>
210<td>0.755</td>
211</tr>
212
213<tr>
214<th>lognormal</th>
215<td>0.417</td>
216<td>0.442</td>
217<td>0.470</td>
218<td>0.481</td>
219</tr>
220
221<tr>
222<th>uniform_on_sphere</th>
223<td>0.154</td>
224<td>0.155</td>
225<td>0.174</td>
226<td>0.218</td>
227</tr>
228
229</table>
230<p>
231Note that the lagged Fibonacci generator is at least 2.5 times faster
232than the Mersenne twister when generating uniformly distributed
233floating-point numbers.  For more sophisticated distributions, the
234speed improvement is less.  Note however that these distributions have
235not been optimized for speed, yet.
236<p>
237<hr>
238Jens Maurer, 2001-04-15
239
240</body>
241</html>
Note: See TracBrowser for help on using the repository browser.