# Extremely slow debugging in VS Code

**URL:** <https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762>\
**Category:** New to Julia\
**Tags:** question, debugging, vscode\
**Created:** [January 14, 2025, 1:18pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762 "2025-01-14T13:18:14Z")\
**Posts on this page:** 20\
**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:** [January 14, 2025, 1:18pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/1 "2025-01-14T13:18:14Z")

</div>

I am new to Julia. I installed the application and the VS Code extension. When I run very simple scripts, e.g. just plotting a sin() function, stepping through the program via breakpoints is nearly impossible. Stepping from one line to the next takes up to 3 seconds per line. This is unusable. Also, just starting the debugging takes up to 10 seconds each time. I cant use Julia this way.

Why is this? Shouldn’t it run well out of the box without tinkering? This leaves a bad taste and I tend to just pick Python or Matlab for this task. Here is the code:

```
using Plots
#gr() # Use the GR backend

x = 0:0.1:2π # Initial x values
y = sin.(x) # Initial y values

# Create the initial plot
p = plot(x, y, xlabel="x", ylabel="sin(x)", legend=false, title="Live Updating Plot")
display(p)

# Update the plot in a loop
for i in 1:100
 y = sin.(x .+ i * 0.1) # Shift the sine wave
 plot!(p, x, y) # Update the plot
 display(p)
 sleep(0.01) # Pause to simulate real-time updates
end

```

---

<div class="post-metadata">

**Author:** ![xgdgsc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xgdgsc/32/608_2.png) [@xgdgsc](https://discourse.julialang.org/u/xgdgsc)\
**Post date:** [January 14, 2025, 1:45pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/2 "2025-01-14T13:45:28Z")

</div>

[https://modernjuliaworkflows.org/writing/#infiltrator.jl](https://modernjuliaworkflows.org/writing/#infiltrator.jl)

---

<div class="post-metadata">

**Author:** ![MatthijsCox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matthijscox/32/42831_2.png) [@MatthijsCox](https://discourse.julialang.org/u/MatthijsCox)\
**Post date:** [January 14, 2025, 3:33pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/3 "2025-01-14T15:33:48Z")

</div>

I think what @xgdgsc is trying to say is that Infiltrator.jl is a very nice, very fast debugger (though REPL-based). I myself also use it as my main debugger.

For usage, see the blog post above, the [Infiltrator.jl docs](https://juliadebug.github.io/Infiltrator.jl/dev/) and for example this discourse [How to use Infiltrator? - General Usage - Julia Programming Language](https://discourse.julialang.org/t/how-to-use-infiltrator/124305/7).

Adding the `@infiltrate` (or `Main.@infiltrate`) statement to your code, is kinda like adding a debug point in the VSCode editor.

---

<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:** [January 14, 2025, 4:19pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/4 "2025-01-14T16:19:21Z")

</div>

Thank you. But I guess I don’t want to use an unofficial workaround just to get Julia up to a usable state. Very disappointing. I remember using it a few years ago in the Atom editor it was quite fast. Well I guess I have to use python instead.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [January 14, 2025, 4:31pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/5 "2025-01-14T16:31:04Z")

</div>

Did you check this section of the manual: [Settings to speed up the debugger](https://www.julia-vscode.org/docs/stable/userguide/debugging/#Settings-to-speed-up-the-debugger) ?

---

<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:** [January 14, 2025, 5:10pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/6 "2025-01-14T17:10:58Z")

</div>

I did try ALL\_MODULES\_EXCEPT\_MAIN. I dont see any difference. But this shouldnt be required when starting with a new language. I dont want to jump through hoops just to start working.

A first impression is important for any new programming language, but I feel hardly pushed back by this. So I will not spend time fixing this, which is sad, because Julia seems promising. if it doesnt work out of the box for simple stuff, Julia has no chance getting more popular.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [January 14, 2025, 5:17pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/7 "2025-01-14T17:17:43Z")

</div>

Well, debugging a compiled language will always be more complicated/ slower than debugging an interpreted language.

While some improvements of the Julia debugger are to be expected in the future, for now you must decide what you want:

- a good IDE and a high quality, easy to use debugger
- or a very composable, easy to read language which is super fast in executing complex self-written code

For a. choose Python, for b. choose Julia. I myself never use a debugger. For debugging I call functions from the REPL. But that is a matter of taste.

---

<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:** [January 14, 2025, 5:33pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/8 "2025-01-14T17:33:56Z")

</div>

Thank you. But if I am honest, python as well as matlab, yet even compiled languages as both c++ and c# behave faster and are more responsive than Julia. The compile time for simple scripts on current machines is nearly instand, which is this still faster than the Julia experience. I don’t want to bash on Julia, but I am heavily disappointed, sadly. This is the first time in any language that I negatively notice lag and delay during stepping while debugging.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [January 14, 2025, 5:38pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/9 "2025-01-14T17:38:05Z")

</div>

If you have a good REPL, what do you need a debugger for? I just don’t understand. The REPL of Julia is far superior compared to Python, and for languages like C++ there is none at all.

A different language might require a different approach to programming, and if you do not want to change your habits just stick to Python.

---

<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:** [January 14, 2025, 5:43pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/10 "2025-01-14T17:43:44Z")

</div>

> [@ufechner7](#):
>
> If you have a good REPL, what do you need a debugger for?

Please, not this again. I need a debugger, there’s no reason to argue against that. A REPL cannot help me understand what is going wrong, linestepping is required.

While I find the tone of the OP pretty annoying, I also find the vs code debugger exceptionally slow at the moment, and crashing a lot. Not sure if my laptop is also acting up.

---

<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:** [January 14, 2025, 5:45pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/11 "2025-01-14T17:45:55Z")

</div>

Now I am surprised. You don’t use a debugger? I can’t live without a debugger. How do you check if your programming logic works as intended? Don’t you need to step through functions line by line to observe what they do? This is the most essential tool in any programming environment and language.

---

<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:** [January 14, 2025, 5:47pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/12 "2025-01-14T17:47:31Z")

</div>

I don’t want to sound annoying, it’s just stating the obvious. I just didn’t understand why this is so slow on modern high performance machines.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [January 14, 2025, 5:48pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/13 "2025-01-14T17:48:13Z")

</div>

> [@DNF](#):
>
> A REPL cannot help me understand what is going wrong,

Why not? Just declare the variables you are interested in as global, call the function you are trying to debug and look at the content of the variables of interest. If your functions are too large, then your programming style is problematic.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [January 14, 2025, 5:49pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/14 "2025-01-14T17:49:06Z")

</div>

> [@MathMan](#):
>
> I just didn’t understand why this is so slow on modern high performance machines.

Because the debugger executes the Julia code in interpreter mode, and this interpreter is not much optimized because it is not used a lot. You can decide to compile the parts of the code that you are not debugging, like packages that you are using, and then you get a reasonable speed. But you must decide and configure which parts get compiled and which gets interpreted.

---

<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:** [January 14, 2025, 5:50pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/15 "2025-01-14T17:50:25Z")

</div>

Yeah but then it should be at least as fast as MATLAB… In comparison MATLAB is instand.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [January 14, 2025, 5:54pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/16 "2025-01-14T17:54:22Z")

</div>

You are comparing a very old, closed source language (Matlab) with a new, open source language. Lots of $$$ went into the development of the Matlab development environment and debugger, a lot less (perhaps 1%) into the development of the Julia tooling.

To claim some Julia tooling should do this or that without contributing time or money is not fair and pointless, actually, because it will not change anything.

Feel free to improve the performance of [JuliaInterpreter.jl](https://github.com/JuliaDebug/JuliaInterpreter.jl) or pay someone who does that for you.

---

<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:** [January 14, 2025, 6:05pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/17 "2025-01-14T18:05:59Z")

</div>

Fair point.

---

<div class="post-metadata">

**Author:** ![p\_f](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@p\_f](https://discourse.julialang.org/u/p_f)\
**Post date:** [January 14, 2025, 6:36pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/18 "2025-01-14T18:36:28Z")

</div>

Hi MathMan, when you added `ALL_MODULES_EXCEPT_MAIN`, did you click “Apply default compiled modules/functions”? Found in the “Run and debug” tab in vscode:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/b/4bcbb4c6f58cf1b0ba9c07219fcc530c78580c1c.png)

This made things much better for me

edit: video for example of it not taking too long after adding `ALL_MODULES_EXCEPT_MAIN`. Also note I’m using `@enter` to debug a function, so I’ve put your code into a function.

---

<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:** [January 14, 2025, 6:37pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/19 "2025-01-14T18:37:32Z")

</div>

> [@ufechner7](#):
>
> Why not? Just declare the variables you are interested in as global, call the function you are trying to debug and look at the content of the variables of interest.

Because the code is far to complicated, involving lots of complicated objects interacting, involving lots of iteration and optimization with automatic differentiation. A static snapshot of variables tells me nothing, I need to follow the program flow and discover where the optimization starts failing.

> [@ufechner7](#):
>
> If your functions are too large, then your programming style is problematic.

Please believe when I say I have spent hundreds of hours trying to make everything as simple as possible. But it is _really_ hard to even find valid solutions.

---

<div class="post-metadata">

**Author:** ![MatthijsCox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matthijscox/32/42831_2.png) [@MatthijsCox](https://discourse.julialang.org/u/MatthijsCox)\
**Post date:** [January 14, 2025, 7:01pm UTC](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762/20 "2025-01-14T19:01:39Z")

</div>

I feel like this topic deserves a long nuanced blog post about the benefits of debugging versus testing (REPL-based or with an extensive test suite). But alas I don’t have one ready.

Some personal points:

- The VSCode Julia debugger is slow. Really slow. We should acknowledge that pain point. However the VSCode plugin maintainers just dont have the time to improve that. And no one is helping them yet.
- Infiltrator.jl is really nice and in no way “an unofficial workaround”.
- MATLAB debugging is incredibly easy. Probably too easy, thus causing a form of debug-driven development, which breaks down for large collaborative software projects. (I admit I was a debug-driven programmer in the past.)
- A debugger is just one tool in a programmers toolkit.
- My main debugging usecase is to quickly find the exact data that goes into the problematic function. And then build a reproducible test out of that.

[Next page](https://discourse.julialang.org/t/extremely-slow-debugging-in-vs-code/124762.md?page=2)
