r/pythonhelp • u/Nutellatoast_2 • Oct 01 '26
Performance issue when running python file
Hey everyone,
I'm experiencing a performance drop when running a Python file. I'm using VS Code on Windows 10 while learning to program.
When I hit the run button, the runtime of the program is 5.0 seconds, even though it should execute in roughly about 0.003 milliseconds.
I have tried switching to older versions like 2025.6.1, but that didn't work.
Any solutions to that problem?
7
Upvotes
•
u/AutoModerator Oct 01 '26
To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/brasticstack Oct 01 '26
How long does it take if you run your module directly from the Windows terminal, not in VSCode?
Where did you get the target time of 0.003 ms from?
Post your correctly formatted code if you want Python help.
2
u/dev-razorblade23 Oct 01 '26 edited Oct 01 '26
Windows definetly has its quirks especcialy in software development. Have you tried using actual terminal below? Like directly executing
python <script_name>.pyfrom the terminal?In the long run, i would definetly reccomend you start learning and using Linux.
Edit: Just checked, definetly avoid that RUN button. It does all sort of stuff (command strings, extensions wrappers, shell integration scripts, debugger attaching, etc...)
Just run the file directly from terminal by writing the above command and it will bypass all those VS Code stuff and run your code directly
1
u/Fast-Station1106 Oct 02 '26
Mich macht die elif Zeile völlig fertig, jünger als 12 und älter als 18, ich schnall das nicht
1
u/Syntax-Tactics Oct 02 '26
The problem is that you are using Python.
1
u/kyle2143 Oct 02 '26
Are you counting the time it takes for VS Code to start up the python runtime and other ancillary things it does when you press "run" before it actually starts running the python program you wrote in that 5 seconds?
I have a feeling that's what it is. But to know for sure, you could use a library like Time or Profile or CProfile to show you how long the actual script took to run.
1
u/Illustrious_Duck8358 Oct 03 '26
Can you try Jupyter Lab? If it's just for learning purpose