On 28/06/2021 12:31 pm, Andrew Rowley wrote:
On 28/06/2021 1:51 pm, David Crayford wrote:
That not particularily fast either. How can Python be faster than C?

danielspaangberg_1of2;2756;5.000862;1;algorithm=base,faithful=yes,bits=1


How did you run the Python version? From the comments it looks like running it using PyPy improves the speed about 10x (JIT compiled I think). People have also created Python versions using numeric libraries which are much faster than the original. I'm not sure what optimizations have been included.

TS8004@RSD6 ~/Primes/PrimePython/solution_2 (drag-race) ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── [12:42:56]
> python3 PrimePY.py -t 5
Passes: 3451, Time: 5.001404762268066, Avg: 0.0014492624637114072, Limit: 1000000, Count: 78498, Valid: True
ssovest; 3451;5.001404762268066;1;algorithm=base,faithful=yes,bits=8


The original video was C++ vs C# vs Python:
https://www.youtube.com/watch?v=D3h62rgewZM

Python was slower as expected.

Well, I'm seeing different results on z/OS. There is no PyPy on z/OS.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to