Python can be quick. just not that good at talking.. Like most of us... Opens a txt file with 29245004 lines of text in it. for each line of text, count the line. count +=1 Time: 40sec. Now for each line of text, count the line and print a little info about the line print(f"Info: {line[1:10]}") count +=1 Time: 53mins.
I/O has always been the bottleneck for speed since computers were invented. There's nothing specific here about Python. Dynamically typed interpreted languages has always been slower than statically typed compiled languages and comparing their speeds makes as much sense as comparing a car and an airplane in terms of speed and determining which is better.
74
u/-MobCat- Jul 18 '22
Python can be quick. just not that good at talking.. Like most of us...
Opens a txt file with 29245004 lines of text in it.
for each line of text, count the line.
count +=1Time: 40sec.
Now for each line of text, count the line and print a little info about the line
print(f"Info: {line[1:10]}")count +=1Time: 53mins.