[Numpy-discussion] Question about optimizing random_standard_normal
Robert Kern
robert.kern at gmail.com
Mon Feb 8 10:40:40 EST 2021
On Mon, Feb 8, 2021 at 3:05 AM Kevin Sheppard <kevin.k.sheppard at gmail.com>
wrote:
> If I understand correctly, there is no gain when applying this patch to
> Generator. I'm not that surprised that this is the case since the compiler
> is much more limited in when it can do in Generator than what it can when
> filling a large array directly with functions available for inlining and
> unrolling. Again, if I understand correctly I think it will be difficult to
> justify breaking the stream for a negligible gain in performance.
>
Can you explain your understanding of the benchmark results? To me, it
looks like nearly a 2x improvement with the faster BitGenerators (our
default PCG64 and SFC64). That may or may not worth breaking the stream,
but it's far from negligible.
> But I did run the built-in benchmark: ./runtests.py --bench
>> bench_random.RNG.time_normal_zig and the results are:
>>
>>
>> new old
>> PCG64 589±3μs 1.06±0.03ms
>> MT19937 985±4μs 1.44±0.01ms
>> Philox 981±30μs 1.39±0.01ms
>> SFC64 508±4μs 900±4μs
>> numpy 2.99±0.06ms 2.98±0.01ms # no change for /dev/urandom
>>
>
--
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/numpy-discussion/attachments/20210208/5bc42138/attachment.html>
More information about the NumPy-Discussion
mailing list