0

I was faced with the following problem: on a computer (number 2) script execution time is significantly greater than on another computer (computer 1).

  • Computer 1 - i3 - 4170 CPU @ 3.7 GHz (4 core), 4GB RAM (Execution time 9.5 minutes)
  • Computer 2 - i7 - 3.07GHz (8 core), 8GB RAM (Execution time 15-17 minutes)

I use Python to process Excel files. I import for these three libraries:

  • xlrd, xlsxwriter, win32com

Why is the execution time different? How can I fix it?

  • 1
    FWIW, your 'faster pc' has more GHz per core (3.7 vs 3.07). Python uses only 1 core due to the [Global Interpreter Lock (GIL)](http://stackoverflow.com/questions/4496680/python-threads-all-executing-on-a-single-core), so the more GHz per core, the faster your script. – Nander Speerstra Aug 03 '16 at 07:42

2 Answers2

1

It runs on single core, the computer1 has higher clock rate = faster single threaded processing.

0

As explained in a comment, Python uses the Global Interpreter Lock (GIL). As stated on the Wiki: "An interpreter that uses GIL always allows exactly one thread to execute at a time, even if run on a multi-core processor".

Your i3 processor may 'only' have 4 cores instead of the 8 cores in your i7, but Python will only use 1 thread at a time: so the faster the core, the faster your script is executed. As explained on this page: "The CPU speed determines how many calculations it can perform in one second of time. The higher the speed, the more calculations it can perform, thus making the computer faster."

Nander Speerstra
  • 1,496
  • 6
  • 24
  • 29