Skip to content

Commit 741d99c

Browse files
Sheppard, KevinSheppard, Kevin
authored andcommitted
FIX: Fix scale in performance
1 parent baa6641 commit 741d99c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

randomstate/performance.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import struct
2+
import os
23
import timeit
34

45
import pandas as pd
6+
from numpy.random import RandomState
7+
rs = RandomState()
58

69
SETUP = '''
710
import {mod}.{rng}
@@ -10,7 +13,7 @@
1013
'''
1114

1215
scale_32 = scale_64 = 1
13-
if struct.calcsize('P') ==8:
16+
if struct.calcsize('P') == 8 and os.name != 'nt':
1417
# 64 bit
1518
scale_32 = 0.5
1619
else:
@@ -68,6 +71,11 @@ def timer_uniform():
6871
def timer_32bit():
6972
command = 'rs.{dist}(1000000, bits=32)'
7073
command_numpy = 'rs.tomaxint({scale} * 1000000)'.format(scale=scale_32)
74+
print('32 bit commands')
75+
print(command)
76+
print(command_numpy)
77+
print('Typical values')
78+
print(rs.tomaxint(5))
7179
dist = 'random_uintegers'
7280
run_timer(dist, command, command_numpy, SETUP, '32-bit unsigned integers')
7381

@@ -76,6 +84,9 @@ def timer_64bit():
7684
dist = 'random_uintegers'
7785
command = 'rs.{dist}(1000000, bits=64)'
7886
command_numpy = 'rs.tomaxint({scale} * 1000000)'.format(scale=scale_64)
87+
print('64 bit commands')
88+
print(command)
89+
print(command_numpy)
7990
run_timer(dist, command, command_numpy, SETUP, '64-bit unsigned integers')
8091

8192

0 commit comments

Comments
 (0)