[Numpy-discussion] Question about optimizing random_standard_normal

Robert Kern robert.kern at gmail.com
Mon Feb 8 11:05:27 EST 2021


On Mon, Feb 8, 2021 at 10:53 AM Kevin Sheppard <kevin.k.sheppard at gmail.com>
wrote:

> My reading is that the first 4 are pure C, presumably using the standard
> practice of inclining so as to make the tightest loop possible, and to
> allow the compiler to make other optimizations.  The final line is what
> happens when you replace the existing ziggurat in NumPy with the new one. I
> read it this way since it has both “new” and “old” with numpy. If it isn’t
> this, then I’m unsure what “new” and “old” could mean in the context of
> this thread.
>

No, these are our benchmarks of `Generator`. `numpy` is testing
`RandomState`, which wasn't touched by their contribution.


https://github.com/numpy/numpy/blob/master/benchmarks/benchmarks/bench_random.py#L93-L97

https://github.com/numpy/numpy/blob/master/benchmarks/benchmarks/bench_random.py#L123-L124


> I suppose camel-cdr can clarify what was actually done.
>

But I did run the built-in benchmark: ./runtests.py --bench
> bench_random.RNG.time_normal_zig and the results are:
>
>
-- 
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/numpy-discussion/attachments/20210208/82ed257b/attachment-0001.html>


More information about the NumPy-Discussion mailing list