I am new to computer science, so excuse me if the question is inappropriate or sounds absurd to you.
In the textbook, it says that a typical laptop can execute 1 billion instructions per second. Therefore, I thought that if I wrote a never-ending piece of algorithm, it would generate tons lines in the program counsel after running it for 10 seconds. Taking into account the time it needs to convert to machine instructions, and the fact that other programs needed to be executed as well, the number I expected was some where about one million of instructions per second and thus 10 millions per 10 second.
I tried to run something like this:
While 1+1=2: Print(0)
To my surprise, I found that the print instruction had been executed for less than 4,000 times within 10 seconds. I know that my original estimation was not meant to be accurate but I was not expecting the speed to be this slow. I think maybe the read-writing speed of my ssd was the major drawback. I know that sending instruction to the screen is even slower, but that should not affect the CPU's performance.
So, here are my questions:
What are the major factors that slow down the speed?
Are there any other factors that I overlook?
Is there a way to know exactly or make reasonably accurate estimation of the Python code execution rate?
And are there any suggestions to speed up the execution rate?
Even if it takes time to send instructions to the monitor, the processor can still utilize the gap in between to execute other instructions. So, does that exclude slow I/O speed as a drawback?
If the hidden layer between me and the machine already figures out what to do in the beginning, is it going to repeat the same instruction without executing extra instructions?
It is possible to have the processor focus on a piece program without executing any other program at all?
Thank you for your help in advance.