python - computing cost of np.random.uniform vs np.random.beta -
i have algorithm uses np.random.uniform switch np.random.beta and/or np.random.gamma improve efficiency of approximation. since algorithm quite time consuming (~8hours) , memory intensive (5 gb per thread) wanted check if there information on how cost me before tried run.
since called inside loop, should assume not going change memory requirements?
what difference in run time?
just test using ipython:
in [1]: import numpy np in [2]: %timeit np.random.random(1000) 100000 loops, best of 3: 9.25 µs per loop in [3]: %timeit np.random.beta(0.5, 0.5, 1000) 10000 loops, best of 3: 45.3 µs per loop
this imply factor of 5, appears depend on parameters of beta.
nevertheless, before drawing conclusions, should sure random number generation time-limiting factor algorithm. run profiler find out real bottlenecks are.