Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


View this topic in a long page with up to 500 replies per page Create new topic
1 | 2 | 3
JaseNZ

2576 posts

Uber Geek
+1 received by user: 1489

ID Verified
Lifetime subscriber

  #2648903 7-Feb-2021 11:16
Send private message

zenourn:

 

I suspect this isn't the best of benchmarks. 

 

 

Nar its just a bit of fun mucking around.

 

Interesting to see your results guys thanks for trying it out 😀





Ding Ding Ding Ding Ding : Ice cream man , Ice cream man




SirHumphreyAppleby
2942 posts

Uber Geek
+1 received by user: 1863


  #2648908 7-Feb-2021 11:30
Send private message

I was interested in seeing how fast this was on an APU2, but I don't have Python installed on those. Here's a Raspberry Pi 3 Model B Plus Rev 1.3 instead...

 

Find all primes up to: 200000 using 16 processes.
Time elapsed: 517.57 seconds
Number of primes found 17984


JaseNZ

2576 posts

Uber Geek
+1 received by user: 1489

ID Verified
Lifetime subscriber

  #2648915 7-Feb-2021 11:47
Send private message

I actually wanted to try this after watching this. Was an interesting watch.

 

https://www.youtube.com/watch?v=hGyJTcdfR1E&t

 

 





Ding Ding Ding Ding Ding : Ice cream man , Ice cream man




Gordy7
gordy7
2001 posts

Uber Geek
+1 received by user: 505

ID Verified
Lifetime subscriber

  #2648920 7-Feb-2021 12:22
Send private message

i7 7700K (CPU running at 4.49 GHz during Prime test)

 

Loaded Python 3.9 and ran script.

 

Find all primes up to: 200000 using 32 processes.
Time elapsed: 23.83 seconds
Number of primes found 17984

 

After a reboot

 

Find all primes up to: 200000 using 32 processes.
Time elapsed: 15.74 seconds
Number of primes found 17984

 

 





Gordy

 

My first ever AM radio network connection was with a 1MHz AM crystal(OA91) radio receiver.


maslink
131 posts

Master Geek
+1 received by user: 41

Subscriber

  #2648978 7-Feb-2021 14:15
Send private message

MacBook Pro (2016) - i7-6700HQ @ 2.6 GHz 

 

Find all primes up to: 200000 using 32 processes.
Time elapsed: 37.9 seconds
Number of primes found 17984

 

Raspberry Pi400 @ 2GHz

 

Find all primes up to: 200000 using 16 processes.
Time elapsed: 164.48 seconds
Number of primes found 17984


Mehrts
1112 posts

Uber Geek
+1 received by user: 984

Trusted

  #2648982 7-Feb-2021 14:37
Send private message

Since results for a RPi 3B+ have been posted, I thought I'd dig out a RPi 4B (4GB RAM) running a fresh install of RaspPiOS & stock CPU speeds.

 

Find all primes up to: 20000 using 16 processes.
Time elapsed: 183.29 seconds
Number of primes found 17984

 

Not a bad performance boost from the previous gen RPi. These wee things are really packing a punch now.


 
 
 

Shop on-line at New World now for your groceries (affiliate link).
paulgr
1133 posts

Uber Geek
+1 received by user: 71


  #2649043 7-Feb-2021 18:09
Send private message

Comparing an 8700k PC with Apples new M1 Macbook Pro:

 

Both running Python 3.91

 

8700k 16gb 256gb EVO SSD:

 

Find all primes up to: 200000 using 24 processes.
Time elapsed: 11.6 seconds
Number of primes found 17984

 

M1 Macbook Pro 16gb:

 

Find all primes up to: 200000 using 32 processes
Time elapsed: 12.23 seconds
Number of primes found 17984

 

 

 

Paul (1st post)


JaseNZ

2576 posts

Uber Geek
+1 received by user: 1489

ID Verified
Lifetime subscriber

  #2649129 7-Feb-2021 19:13
Send private message

This was my 2018 Macbook pro core i7 

 

 

 

Jasons-MacBook-Pro:Documents jason$ python3 prime2.py

 

Find all primes up to: 200000 using 48 processes.

 

Time elapsed: 22.41 seconds

 

Number of primes found 17984





Ding Ding Ding Ding Ding : Ice cream man , Ice cream man


nzkc
1634 posts

Uber Geek
+1 received by user: 1041


  #2649191 7-Feb-2021 19:58
Send private message

My Ryzen 5 1600 rig built some time ago and running a bunch of VMs:

 

Find all primes up to: 200000 using 48 processes.
Time elapsed: 12.79 seconds
Number of primes found 17984

 

Edit:

 

And a Huawei Matebook D15 with a Ryzen 3500U:

 

Find all primes up to: 200000 using 32 processes.
Time elapsed: 22.26 seconds
Number of primes found 17984

 

 

 

I expected those to be closer TBH. The first one runs Linux, the second Windows. Guess thats the difference between a desktop and mobile CPU!


sJBs
69 posts

Master Geek
+1 received by user: 12

ID Verified

  #2649199 7-Feb-2021 20:13
Send private message

python test.py
Find all primes up to: 200000 using 32 processes.
Time elapsed: 75.0 seconds
Number of primes found 17984

 

Python 2.7.17 (default, Sep 30 2020, 13:38:04) 
[GCC 7.5.0] on linux2

 

Intel i7-3820 from 2012.

 

 





Linux Mint 19.3 (Yes upgrade is overdue)  with ZFS and multiple replicating XigmaNas servers (BSD with ZFS) for storage, all connected via Mikrotik Routerboard (firewall) to a Huawei 618 for Spark Wireless Broadband... 


TheoM
229 posts

Master Geek
+1 received by user: 55

ID Verified
Trusted

  #2649207 7-Feb-2021 20:40
Send private message

% python3 prime2.py
Find all primes up to: 200000 using 96 processes.
Time elapsed: 5.65 seconds
Number of primes found 17984

 

Ryzen 9 3900X on my OpenShift cluster

 

 

 

 





Hi! I'm TheoM, but you know that already. I run Linux mirrors in NZ together with 2degrees. Like a mirror added? PM me!

 


 

https://theom.co.nz | https://theom.nz | https://mirrorlist.mirrors.theom.nz | Providing Free Mirrors Since Ages Ago™


 
 
 

Support Geekzone with one-off or recurring donations Donate via PressPatron.
SirHumphreyAppleby
2942 posts

Uber Geek
+1 received by user: 1863


  #2649210 7-Feb-2021 20:48
Send private message

I was curious to see how Python compared to C. I used TinyCC as a comparison, including the compile and execution time. The C programme ran for 2.38 seconds, versus 21.59 seconds for the Python. Adding what appears to be deliberate inefficiencies in the Python code to the C version (checking all candidate numbers, not just odd numbers, and all lower numbers as divisors), the run time for the C version is 5.15 seconds. Python is only three times slower (although the C code is single threaded). I'd consider that pretty good.

 

 

#define max_number 200000

int is_prime(int candidate_number)
{
       int divisor;
       int divisor_end;
       int found_prime;

       found_prime = 1;
       for(divisor = 2, divisor_end = candidate_number / 2; found_prime && divisor <= divisor_end; divisor++) {
               if(candidate_number % divisor == 0) found_prime = 0;
       }
       return found_prime;
}

int main()
{
       int num_primes;
       int candidate_number;

       for(num_primes = 1, candidate_number = 3; candidate_number < max_number; candidate_number += 2) {
               if(is_prime(candidate_number)) num_primes++;
       }
       printf("Number of primes found %d\n", num_primes);
       return 0;
}


ANglEAUT
altered-ego
2436 posts

Uber Geek
+1 received by user: 842

Trusted
Lifetime subscriber

  #2649257 7-Feb-2021 23:46
Send private message

sJBs: ... Time elapsed: 75.0 seconds
...
Intel i7-3820 from 2012.

 

Interesting. My 8 core i7-3770 CPU @ 3.40GHz did

 

$ python find-prime_multicore.py (fixed script)
Find all primes up to: 200000 using 32 processes.
Time elapsed: 121.91 seconds
Number of primes found 17984

$ python find-prime_singlecore.py (original script)
Find all primes up to: 200000 using 32 processes.
Time elapsed: 202.8 seconds
Number of primes found 17984

 

I wonder how much closer I could get with a clean reboot?

 

 





Please keep this GZ community vibrant by contributing in a constructive & respectful manner.


ANglEAUT
altered-ego
2436 posts

Uber Geek
+1 received by user: 842

Trusted
Lifetime subscriber

  #2649259 7-Feb-2021 23:56
Send private message

SirHumphreyAppleby:

 

Here's a Raspberry Pi 3 Model B Plus Rev 1.3 instead...
Time elapsed: 517.57 seconds

 

Mehrts:

 

I thought I'd dig out a RPi 4B (4GB RAM)
Time elapsed: 183.29 seconds

 

 

 

Raspberry Pi 4 Model B Rev 1.4 (4 core Cortex-A72 / 8GB RAM)

 

$ python3 find-prime_multicore.py 
Find all primes up to: 200000 using 16 processes.
Time elapsed: 82.66 seconds
Number of primes found 17984

$ python3 find-prime_singlecore.py 
Find all primes up to: 200000 using 16 processes.
Time elapsed: 298.08 seconds
Number of primes found 17984

 

 





Please keep this GZ community vibrant by contributing in a constructive & respectful manner.


zenourn
281 posts

Ultimate Geek
+1 received by user: 168

ID Verified
Trusted
DR

  #2649367 8-Feb-2021 11:05
Send private message

I usually run number crunching Python code these days with pypy, and it does give a reasonable improvement:

 

$python3 prime.py
Find all primes up to: 200000 using 256 processes.
Time elapsed: 3.01 seconds
Number of primes found 17984

 

$ pypy prime.py
Find all primes up to: 200000 using 256 processes.
Time elapsed: 1.21 seconds
Number of primes found 17984

 

 


1 | 2 | 3
View this topic in a long page with up to 500 replies per page Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.