Home>
I feel that python is slow.
When I executed the for statement, it didn't end easily.
What should I do if I don't know the cause?
time1 = time.time ()
for i in range (10000):
print (i)
print (time.time ()-time1)
# 2.1952428817749023
-
Answer # 1
-
Answer # 2
It was 0.6711642742156982 when I executed it with Spyder at hand.
... I don't think it's slowPython 3.7.5, Linux Mint19.2, AMD Ryzen 5 1600X
-
Answer # 3
python is an interpreter.
That's slow
Related articles
Related questions
- how to save the image ocr result file in python
- python - i can't pip install with docker and get modulenotfounderror
- python - icrawler cannot save images
- python - i get the error shapes (1,1) and (2,) not aligned in the process of leave one out cross variation (loocv)
- command does not start in python discordbot
- python - pandas dataframe comparison (dfequals) doesn't work is it because the individual element read from the csv file has a d
- python - [django] isn't the "except pagenoeaninteger" block running in viewspy?
- error in python, subprocess
- [python] functions in the class that inherits formatter do not work
- error in python/discord bot
The slowest is print. Console screen input/output is a very heavy process, so it takes some time to go in any language.
If possible, output to a file instead of a screen.
For Python, in addition to that, for is also slow, so it will be a little faster if you first assemble the string with comprehensions.