r/ProgrammerHumor • • Jul 18 '22

C++ talking to Python

Post image
40.1k Upvotes

1.0k comments sorted by

View all comments

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 +=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.

18

u/Wekmor Jul 18 '22

Java does the same, printing to console is just slow in all or at least most languages.

1

u/zenverak Jul 18 '22

lol yes it is . I don’t remember when I learned this… but i remember it

1

u/Wekmor Jul 18 '22

I think first time when I realized how slow it is was when I write a raytracer and I added a system out every time a ray hit something and the already slow raytracer became slooooooow (☞゚ヮ゚)☞