eifjeowj
eifjeowj

Reputation: 21

Is Python in Visual Studio Code supposed to be this slow?

I am running this simple code that just imports some stuff and defines some variables.

import tensorflow as tf
import numpy as np
import scipy.stats as si
from datetime import datetime

now = datetime.utcnow().strftime("%Y%m%d%H%M%S")
root_logdir = "tf_logs"
logdir = "{}/run-{}/".format(root_logdir, now)

print("hello")

When I run it, I press "start without debugging" in Visual Studio Code.

It then prints this stuff:

Image of terminal

And then it takes about 6 seconds before it's actually ready, and it finally prints "hello".

Why is it so slow? Is this normal? What can I try to fix it?

Upvotes: 2

Views: 5247

Answers (1)

Alex
Alex

Reputation: 1101

You are importing very large libraries (TensorFlow, NumPy, and SciPy) which will take a very long time. In addition, it looks that Visual Studio Code is not directly launching it. All of this will increase the runtime.

To fix this, you should just remove unused inputs. This is probably the fastest you can make it without modifying Visual Studio Code to launch the Python interpreter without its special debugging script.

Upvotes: 1

Related Questions