Skip to content

Commit 6188349

Browse files
committed
PERF: Update performance comparrison
Update performance comparrison to use Ziggurat
1 parent 487cd1f commit 6188349

File tree

2 files changed

+34
-29
lines changed

2 files changed

+34
-29
lines changed

ci/performance.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
'random_sample': {},
2727
'random_raw': {'output': False},
2828
'standard_exponential': {'method': 'zig'},
29-
'standard_gamma': {'shape': 2.4},
29+
'standard_gamma': {'shape': 2.4, 'method': 'zig'},
3030
'standard_normal': {'method': 'zig'},
3131
'multinomial': {'n': 20, 'pvals': [1.0 / 6.0] * np.ones(6)},
3232
'negative_binomial': {'n': 5, 'p': 0.16},
@@ -41,7 +41,7 @@ def timer(prng: str, fn: str, args: dict):
4141
# Differences with NumPy
4242
if fn in ('random_raw', 'complex_normal'):
4343
return np.nan
44-
if fn in ('standard_normal','standard_exponential'):
44+
if fn in ('standard_normal','standard_exponential', 'standard_gamma'):
4545
args = {k: v for k, v in args.items() if k != 'method'}
4646
elif prng == 'mt19937' and fn == 'random_raw': # To make comparable
4747
args['size'] = 2 * args['size']
@@ -111,6 +111,10 @@ def timer(prng: str, fn: str, args: dict):
111111
std_results = std_results.append(overall)
112112
std_results = np.round(std_results, 2)
113113

114+
print('\n\n' + '*'*80)
115+
print(std_results)
116+
print('\n'*4)
117+
114118
sio = StringIO()
115119
std_results.to_csv(sio)
116120
sio.seek(0)

doc/source/performance.rst

+28-27
Original file line numberDiff line numberDiff line change
@@ -33,41 +33,42 @@ uses the Box-Muller transformation rather than the Ziggurat generator.
3333
:header: ,NumPy MT19937,MT19937,SFMT,dSFMT,xoroshiro128+,xorshift1024,PCG64
3434
:widths: 14,14,14,14,14,14,14,14
3535

36-
Raw,,5.07,1.98,1.91,1.08,1.49,3.16
37-
Random Integers,4.84,3.32,2.36,3.36,1.99,2.53,2.32
38-
Uniforms,10.41,6.53,2.7,2.7,1.58,2.31,2.47
39-
Normal,69.4,15.34,9.93,11.57,9.56,11.69,11.64
40-
Complex Normal,,40.57,28.05,31.91,25.8,31.9,31.86
41-
Binomial,77.46,71.08,65.77,65.71,66.18,67.23,69.51
42-
Gamma,107.42,97.66,86.5,86.09,82.31,87.42,86.41
43-
Exponential,112.54,104.16,96.23,95.22,93.98,98.15,98.36
44-
Laplace,116.09,114.2,102.35,100.21,100.5,105.9,104.82
45-
Poisson,151.65,135.11,105.1,103.89,102.43,116.29,114.34
46-
Neg. Binomial,476.34,453.07,429.23,426.31,423.45,429.81,430.05
47-
Multinomial,1166.63,1146.25,1111.39,1097.51,1095.43,1103.77,1109.79
36+
Raw,,4.21,1.81,1.7,1.06,1.5,2.67
37+
Random Integers,4.56,3.11,2.09,2.96,1.93,2.34,2.22
38+
Uniforms,9.77,6.13,2.41,2.22,1.46,2.37,2.56
39+
Normal,62.47,13.77,9.11,10.89,7.8,10.48,10.67
40+
Exponential,98.35,9.85,5.72,7.22,5.56,6.32,10.88
41+
Complex Normal,,37.07,24.41,27.88,23.31,27.78,28.34
42+
Gamma,97.99,44.94,38.27,33.41,31.2,34.18,34.09
43+
Binomial,87.99,79.95,78.85,77.12,76.88,76.09,76.99
44+
Laplace,101.73,103.95,91.57,89.02,91.94,93.61,92.13
45+
Poisson,131.93,119.95,99.42,94.84,92.71,100.28,101.17
46+
Neg. Binomial,433.77,416.69,410.2,397.71,389.21,396.14,394.78
47+
Multinomial,1072.82,1043.98,1021.58,1019.22,1016.7,1013.15,1018.41
48+
4849

4950
The next table presents the performance relative to `xoroshiro128+`. The overall
5051
performance was computed using a geometric mean.
5152

5253
.. csv-table::
5354
:header: ,NumPy MT19937,MT19937,SFMT,dSFMT,xoroshiro128+,xorshift1024,PCG64
5455
:widths: 14,14,14,14,14,14,14,14
55-
56-
Raw,,4.69,1.83,1.77,1.0,1.38,2.93
57-
Random Integers,2.43,1.67,1.19,1.69,1.0,1.27,1.17
58-
Uniforms,6.59,4.13,1.71,1.71,1.0,1.46,1.56
59-
Normal,7.26,1.6,1.04,1.21,1.0,1.22,1.22
60-
Complex Normal,,1.57,1.09,1.24,1.0,1.24,1.23
61-
Binomial,1.17,1.07,0.99,0.99,1.0,1.02,1.05
62-
Gamma,1.31,1.19,1.05,1.05,1.0,1.06,1.05
63-
Exponential,1.2,1.11,1.02,1.01,1.0,1.04,1.05
64-
Laplace,1.16,1.14,1.02,1.0,1.0,1.05,1.04
65-
Poisson,1.48,1.32,1.03,1.01,1.0,1.14,1.12
66-
Neg. Binomial,1.12,1.07,1.01,1.01,1.0,1.02,1.02
67-
Multinomial,1.06,1.05,1.01,1.0,1.0,1.01,1.01
68-
Overall,1.84,1.55,1.14,1.19,1.0,1.15,1.22
56+
57+
Raw,,3.97,1.71,1.6,1.0,1.42,2.52
58+
Random Integers,2.36,1.61,1.08,1.53,1.0,1.21,1.15
59+
Uniforms,6.69,4.2,1.65,1.52,1.0,1.62,1.75
60+
Normal,8.01,1.77,1.17,1.4,1.0,1.34,1.37
61+
Exponential,17.69,1.77,1.03,1.3,1.0,1.14,1.96
62+
Complex Normal,,1.59,1.05,1.2,1.0,1.19,1.22
63+
Gamma,3.14,1.44,1.23,1.07,1.0,1.1,1.09
64+
Binomial,1.14,1.04,1.03,1.0,1.0,0.99,1.0
65+
Laplace,1.11,1.13,1.0,0.97,1.0,1.02,1.0
66+
Poisson,1.42,1.29,1.07,1.02,1.0,1.08,1.09
67+
Neg. Binomial,1.11,1.07,1.05,1.02,1.0,1.02,1.01
68+
Multinomial,1.06,1.03,1.0,1.0,1.0,1.0,1.0
69+
Overall,2.61,1.62,1.15,1.2,1.0,1.16,1.28
6970

7071

7172
.. note::
7273

73-
All timings were taken using Linux and gcc 5.4 on a i7-5600U processor.
74+
All timings were taken using Linux and gcc 5.4 on a i5-3570 processor.

0 commit comments

Comments
 (0)