# Very slow startup in VScode

**URL:** <https://discourse.julialang.org/t/very-slow-startup-in-vscode/46996>\
**Category:** Performance\
**Created:** [September 21, 2020, 11:17am UTC](https://discourse.julialang.org/t/very-slow-startup-in-vscode/46996 "2020-09-21T11:17:33Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![MathMan](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@MathMan](https://discourse.julialang.org/u/MathMan)\
**Post date:** [September 21, 2020, 11:17am UTC](https://discourse.julialang.org/t/very-slow-startup-in-vscode/46996/1 "2020-09-21T11:17:33Z")

</div>

I am new to Julia and I am using vscode with the Julia extension to run code. Unfortunately, Julia responds incredibly slow. Outputs into the terminal take 7-8 seconds every time I run this simple script.

```
a = 2
b = 3
c = a + b
print(c)

```

Why does it take so long and what can I do to solve this? If I use Julia directly in the terminal it responds very fast, but obviously, I need to run scripts.

---

<div class="post-metadata">

**Author:** ![fbanning](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fbanning/32/14972_2.png) [@fbanning](https://discourse.julialang.org/u/fbanning)\
**Post date:** [September 21, 2020, 11:27am UTC](https://discourse.julialang.org/t/very-slow-startup-in-vscode/46996/2 "2020-09-21T11:27:25Z")

</div>

This simple script definitely shouldn’t take long to run. In my case, if I execute your simple script line by line, the first line takes about 2 seconds to show up and get executed. All the following lines are executed “instantaneously”.

First time startup of the Julia REPL in VSCode takes some time because it first has to precompile some dependencies for VSCode itself and for Revise. Try to run the script twice in a row without closing the terminal in VSCode. Does the second run also take as long as the first run?

---

<div class="post-metadata">

**Author:** ![MathMan](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@MathMan](https://discourse.julialang.org/u/MathMan)\
**Post date:** [September 21, 2020, 11:36am UTC](https://discourse.julialang.org/t/very-slow-startup-in-vscode/46996/3 "2020-09-21T11:36:32Z")

</div>

I run the code via the run “run file” button. I am not sure what happens in the background. So I dont know if the extension closes the terminal. The second start does not differ noticible from the first one.

---

<div class="post-metadata">

**Author:** ![fbanning](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fbanning/32/14972_2.png) [@fbanning](https://discourse.julialang.org/u/fbanning)\
**Post date:** [September 21, 2020, 11:37am UTC](https://discourse.julialang.org/t/very-slow-startup-in-vscode/46996/4 "2020-09-21T11:37:24Z")

</div>

Try executing the script line by line. `Ctrl + Enter` will do that.

---

<div class="post-metadata">

**Author:** ![MathMan](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@MathMan](https://discourse.julialang.org/u/MathMan)\
**Post date:** [September 21, 2020, 11:38am UTC](https://discourse.julialang.org/t/very-slow-startup-in-vscode/46996/5 "2020-09-21T11:38:34Z")

</div>

This is actually much faster. So how do I execute the whole script this way?

---

<div class="post-metadata">

**Author:** ![fbanning](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fbanning/32/14972_2.png) [@fbanning](https://discourse.julialang.org/u/fbanning)\
**Post date:** [September 21, 2020, 11:43am UTC](https://discourse.julialang.org/t/very-slow-startup-in-vscode/46996/6 "2020-09-21T11:43:29Z")

</div>

`Ctrl + Enter` will execute the current line or selection (i.e. “send line to REPL”).  
`Shift + Enter` will execute a code block which you can create by adding `##` where you want a block to end (i.e. “send code block to REPL”).

You can look these commands up if you open the keyboard shortcut reference (`Ctrl + K Ctrl + S`) and search for Julia.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [September 21, 2020, 11:51am UTC](https://discourse.julialang.org/t/very-slow-startup-in-vscode/46996/7 "2020-09-21T11:51:04Z")

</div>

The “Run File” button currently starts a new Julia process each time it’s used. I’d recommend using the `Julia: Execute File` command instead, which reuses the current Julia REPL.

---

<div class="post-metadata">

**Author:** ![fbanning](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fbanning/32/14972_2.png) [@fbanning](https://discourse.julialang.org/u/fbanning)\
**Post date:** [September 21, 2020, 11:57am UTC](https://discourse.julialang.org/t/very-slow-startup-in-vscode/46996/8 "2020-09-21T11:57:37Z")

</div>

> [@pfitzseb](#):
>
> I’d recommend using the `Julia: Execute File` command instead

Yes, this is what I use as well. I’ve setup a personal shortcut for it to `Shift + Alt + Enter`, maybe you want to do something similar, @MathMan.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [September 21, 2020, 11:58am UTC](https://discourse.julialang.org/t/very-slow-startup-in-vscode/46996/9 "2020-09-21T11:58:10Z")

</div>

Relevant: [https://github.com/julia-vscode/julia-vscode/wiki/Keyboard-shortcuts#replicating-juno-shortcuts](https://github.com/julia-vscode/julia-vscode/wiki/Keyboard-shortcuts#replicating-juno-shortcuts)

---

<div class="post-metadata">

**Author:** ![MathMan](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@MathMan](https://discourse.julialang.org/u/MathMan)\
**Post date:** [September 21, 2020, 12:00pm UTC](https://discourse.julialang.org/t/very-slow-startup-in-vscode/46996/10 "2020-09-21T12:00:03Z")

</div>

Will have a look, thanks.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [September 21, 2020, 12:25pm UTC](https://discourse.julialang.org/t/very-slow-startup-in-vscode/46996/11 "2020-09-21T12:25:19Z")

</div>

> [@pfitzseb](#):
>
> I’d recommend using the `Julia: Execute File` command instead

I’ve wondered about this. Why doesn’t the “Run file” button do this. I was definitely surprised when I heard it started a new process.

---

<div class="post-metadata">

**Author:** ![soldin](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@soldin](https://discourse.julialang.org/u/soldin)\
**Post date:** [May 25, 2023, 3:48pm UTC](https://discourse.julialang.org/t/very-slow-startup-in-vscode/46996/12 "2023-05-25T15:48:02Z")

</div>

Hi, I’m facing the same issue. Discussed here: [Why ODE solver so slow?](https://discourse.julialang.org/t/why-ode-solver-so-slow/98773)

Is there any way to run an already executed (and thus compiled file) from REPL, so that it doesn’t get compile again? Sorry, I could not understand how to use “Julia: Execute File” command.
