Saturday, December 24, 2016

Py CPU Score

What is your Py CPU score?

You are probably asking what "Py CPU Score" is.

I am giving the following simple CPU test the name of Py CPU Score. It uses 2 lines of Python code to determine how fast your CPU is.

Python code for Py CPU Score:
import timeit
int(round(timeit.timeit('"|".join(str(i) for i in range(99999))', number=1000), 0))

This simple code can be used to measure the CPU performance of your computer in a very simple way.

Here are Py CPU Scores for some of my computers:

  • 31 sec ==> Macbook Air 13", 1.6 GHz Intel Core i5, 4Gb memory, OS X El Captain
  • 26 sec ==> Dell Inspiron 1.80 GHz, 2 cores, 8Gb memory, Windows 7 64-bit. 
  • 22 sec ==> Dell Latitude E6540, i7-4810MQ, 2.80 GHz, 16Gb memory, Windows 7 64-bit.

If you are familiar with Python code and you are wondering what this code does, here is a quick explanation:

  • It loops from 0 to 99,998 and appends these numbers to a string that has a separator. That's one unit work and it repeats this unit of work 1,000 times and it calculates how many seconds it took to perform that. 

To establish a good baseline, execute this code when your computer is not doing anything else. Depending on what type of computer you have, you may notice a significant increase in CPU utilization. If you ran around 10 of these Python scripts in parallel, your CPU could approach 100% very quickly. 

Try it out. Comment below with your score and the specs of your computer. 

Almir M.

No comments:

Post a Comment