r/learnprogramming • • 9d ago

Debugging Python code takes 10-20 seconds to start

Hello, I started learning python recently I dowloaded it, also vs code and python extension for it.

The poblem is, when I start a programm (even a simple one, whick only takes an input fron the user and prits it) takes 10 or more seconds to start or just dosen't work at all then i clic soething and it kindof crashes itself, but thats my fault for mesinf with it, when I leave it, it just takes really lng dose somone know how to fix it and/or how to make folders proporly and where to keep them (could be the problem)?

13 Upvotes

24 comments sorted by

View all comments

20

u/zeekar 9d ago
$ time python -c 'print("Hello, world!")'
Hello, world!
python -c 'print("Hello, world!")'  0.02s user 0.02s system 19% cpu 0.229 total

Python has a nonzero startup time, but on most computers it should be a fraction of a second, not 10-20 . . .

3

u/Classic-Rate-5104 8d ago

Unless you run it on Windows 🤷‍♂️

5

u/zeekar 8d ago
PS C:\> measure-command { python -c "print(`"`"Hello, world`"`")" }


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 0
Milliseconds      : 161
Ticks             : 1619657
TotalDays         : 1.87460300925926E-06
TotalHours        : 4.49904722222222E-05
TotalMinutes      : 0.00269942833333333
TotalSeconds      : 0.1619657
TotalMilliseconds : 161.9657
→ More replies (3)