# Performance issue in VS Code \[REPL\] (70x slower) \[was wrong setting\]

**URL:** https://discourse.julialang.org/t/performance-issue-in-vs-code-repl-70x-slower-was-wrong-setting/122910
**Category:** VS Code
**Created:** [November 21, 2024, 9:09pm UTC](https://discourse.julialang.org/t/performance-issue-in-vs-code-repl-70x-slower-was-wrong-setting/122910 "2024-11-21T21:09:22Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![johnb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnb/32/44115_2.png) [@johnb](https://discourse.julialang.org/u/johnb)
#### Post date: [November 21, 2024, 9:09pm UTC](https://discourse.julialang.org/t/performance-issue-in-vs-code-repl-70x-slower-was-wrong-setting/122910/1 "2024-11-21T21:09:22Z")

</div>

I’m not sure exactly when this happened, but at some point, running code in the VS Code REPL became incredibly slow. A simple test I’ve been using to verify this is the mul!() function as below, but all code I’ve tried has been significantly slower in the REPL. I’ve tried updating from Windows 10 to Windows 11, uninstalling and reinstalling VS Code, the Julia extension, compulsively keeping everying up to date, and uninstalling almost all other extensions, but so far nothing has helped. My VS Code and Julia Extension are fully up to date (1.95.3 and 1.127.2 respectively), but this has been going on for a couple months, so it doesn’t seem tied to a particular version. Hopefully this is just me doing something dumb, but any advice you can give on how I might figure this out and fix it would be incredibly helpful.

```julia
using LinearAlgebra, BenchmarkTools

function testmul!(a,b,c)
    mul!(a,b,c)
end

a = rand(10);
b = rand(10,10);
c = rand(10);

@benchmark testmul!(a,b,c)

```

From the REPL, I get the following:

```julia
BenchmarkTools.Trial: 10000 samples with 7 evaluations.
 Range (min … max): 4.729 μs … 9.271 μs ┊ GC (min … max): 0.00% … 0.00%
 Time (median): 4.800 μs ┊ GC (median): 0.00%
 Time (mean ± σ): 4.818 μs ± 187.393 ns ┊ GC (mean ± σ): 0.00% ± 0.00%

    ▁▄▆█▄
  ▂▅█████▁▇▃▃▃▄▄▁▃▂▂▂▂▂▁▁▁▁▂▂▁▁▁▂▂▁▁▂▂▁▂▂▂▁▂▂▂▁▂▂▂▂▂▂▁▂▂▂▂▂▂▂ ▃
  4.73 μs Histogram: frequency by time 5.46 μs <

 Memory estimate: 0 bytes, allocs estimate: 0.

julia> versioninfo()
Julia Version 1.11.1
Commit 8f5b7ca12a (2024-10-16 10:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 12 × AMD Ryzen 5 5600X 6-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 12 default, 0 interactive, 6 GC (on 12 virtual cores)
Environment:
  JULIA_EDITOR = code

```

but from a terminal within VS Code, or even outside of VS Code, I get a much faster result, like this one taken from a terminal opened within VS Code:

```julia
BenchmarkTools.Trial: 10000 samples with 982 evaluations.
 Range (min … max): 62.831 ns … 170.061 ns ┊ GC (min … max): 0.00% … 0.00%
 Time (median): 64.969 ns ┊ GC (median): 0.00%
 Time (mean ± σ): 65.656 ns ± 4.672 ns ┊ GC (mean ± σ): 0.00% ± 0.00%

      ▃█▁
  ▂▂▃▄███▇▅▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▁▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂ ▂
  62.8 ns Histogram: frequency by time 85.2 ns <

 Memory estimate: 0 bytes, allocs estimate: 0.

julia> versioninfo()
Julia Version 1.11.1
Commit 8f5b7ca12a (2024-10-16 10:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 12 × AMD Ryzen 5 5600X 6-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)

```

I’ve also tested it using ` julia --threads=auto` and the results are the same outside of the REPL despite the different number of threads used.

All of this was done on a fresh environment with the following Project and Manifest  
Project:

```julia
[6e4b80f9] BenchmarkTools v1.5.0

```

Manifest:

```julia
  [6e4b80f9] BenchmarkTools v1.5.0
  [682c06a0] JSON v0.21.4
  [69de0a69] Parsers v2.8.1
  [aea7be01] PrecompileTools v1.2.1
  [21216c6a] Preferences v1.4.3
  [10745b16] Statistics v1.11.1
  [56f22d72] Artifacts v1.11.0
  [ade2ca70] Dates v1.11.0
  [8f399da3] Libdl v1.11.0
  [37e2e46d] LinearAlgebra v1.11.0
  [56ddb016] Logging v1.11.0
  [a63ad114] Mmap v1.11.0
  [de0858da] Printf v1.11.0
  [9abbd945] Profile v1.11.0
  [9a3f8284] Random v1.11.0
  [ea8e919c] SHA v0.7.0
  [fa267f1f] TOML v1.0.3
  [cf7118a7] UUIDs v1.11.0
  [4ec0a83e] Unicode v1.11.0
  [e66e0078] CompilerSupportLibraries_jll v1.1.1+0
  [4536629a] OpenBLAS_jll v0.3.27+1
  [8e850b90] libblastrampoline_jll v5.11.0+0

```

---

<div class="post-metadata">

### Author: ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)
#### Post date: [November 21, 2024, 10:05pm UTC](https://discourse.julialang.org/t/performance-issue-in-vs-code-repl-70x-slower-was-wrong-setting/122910/2 "2024-11-21T22:05:19Z")

</div>

Silly question but are you sure you’re not running within the debugger?

---

<div class="post-metadata">

### Author: ![johnb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnb/32/44115_2.png) [@johnb](https://discourse.julialang.org/u/johnb)
#### Post date: [November 21, 2024, 10:13pm UTC](https://discourse.julialang.org/t/performance-issue-in-vs-code-repl-70x-slower-was-wrong-setting/122910/3 "2024-11-21T22:13:00Z")

</div>

Fairly sure. I use shift+enter to interactively run code from files, or type it directly into the Julia REPL terminal. Is there some setting that would send everything through the debugger?

I’ve noticed that typing into the REPL often hangs, making me feel like it’s doing something in the background, but I’m not sure how to check what is happening if anything. For example, typing `]st` sometimes takes several seconds for it to show in the REPL, and more than a minute to print results, whereas from a normal terminal it’s basically instantaneous.

If it helps, I get “fast” results using ipynb files as well, so it really is just the REPL that’s slow for me.

---

<div class="post-metadata">

### Author: ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)
#### Post date: [November 21, 2024, 10:24pm UTC](https://discourse.julialang.org/t/performance-issue-in-vs-code-repl-70x-slower-was-wrong-setting/122910/4 "2024-11-21T22:24:20Z")

</div>

Perhaps some Julia VS Code extension setting is to blame? What’s your settings.json? This is mine:

```json
{
    "editor.tabSize": 4,
    "terminal.integrated.commandsToSkipShell": [
      "language-julia.interrupt"
    ],
    "terminal.integrated.persistentSessionScrollback": 0,
    "terminal.integrated.scrollback": 2000,
    "editor.unicodeHighlight.ambiguousCharacters": false,
    "redhat.telemetry.enabled": true,
    "julia.additionalArgs": [
      "--warn-overwrite=yes",
    ],
    "julia.enableTelemetry": true,
    "julia.enableCrashReporter": true,
    "julia.NumThreads": 8,
    "julia.useRevise": false,
    "julia.executablePath": "/home/nsajko/tmp/jl/jl/julia-1.11.1/bin/julia",
    "julia.symbolCacheDownload": true,
    "workbench.colorTheme": "Solarized Light",
    "window.titleBarStyle": "custom",
    "window.customTitleBarVisibility": "windowed",
}

```

---

<div class="post-metadata">

### Author: ![johnb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnb/32/44115_2.png) [@johnb](https://discourse.julialang.org/u/johnb)
#### Post date: [November 21, 2024, 10:44pm UTC](https://discourse.julialang.org/t/performance-issue-in-vs-code-repl-70x-slower-was-wrong-setting/122910/5 "2024-11-21T22:44:15Z")

</div>

This is my json settings file. It looks like I have Revise enabled by default, but I’ve just tried disabling and reenabling it, and it didn’t change my benchmark results or the general feel of typing in the REPL.

```json
{
    "terminal.integrated.commandsToSkipShell": [
        "language-julia.interrupt",
        "matlab.interrupt"
    ],
    "julia.NumThreads": "auto",
    "workbench.editorAssociations": {
        "*.ipynb": "jupyter.notebook.ipynb",
        "*.rda": "default"
    },
    "python.condaPath": "C:\\Users\\johnb\\miniconda3\\_conda.exe",
    "julia.enableTelemetry": false,
    "julia.symbolCacheDownload": true,
    "julia.trace.server": "messages",
    "julia.additionalArgs": ["--track-allocation=all"
    
    ],
    "notebook.lineNumbers": "on",
    "[python]": {
        "editor.formatOnType": true
    },
    "julia.enableCrashReporter": false,
    "git.autofetch": true,
    "notebook.output.wordWrap": true,
    "python.defaultInterpreterPath": "",
    "terminal.integrated.defaultProfile.windows": "Command Prompt",
    "arduino.useArduinoCli": true,
    "C_Cpp.default.compilerPath": "C:\\msys64\\ucrt64\\bin\\gcc.exe",
    "cmake.buildTask": true,
    "cmake.cmakePath": "C:\\Program Files\\CMake\\bin\\cmake.exe",
    "cmake.generator": "Ninja",
    "cmake.pinnedCommands": [
        "workbench.action.tasks.configureTaskRunner",
        "workbench.action.tasks.runTask"
    ],
    "terminal.integrated.suggest.enabled": true,
    "julia.cellDelimiters": [
        
        "^##(?!#)",
        "^#(\\s?)%%",
        "^#-"
    ]
}

```

---

<div class="post-metadata">

### Author: ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)
#### Post date: [November 22, 2024, 3:10am UTC](https://discourse.julialang.org/t/performance-issue-in-vs-code-repl-70x-slower-was-wrong-setting/122910/7 "2024-11-22T03:10:04Z")

</div>

I strongly suspect this line:

> [@johnb](#):
>
> ```julia
> "julia.additionalArgs": ["--track-allocation=all"
>     
> 
> ```

According to [the Julia documentation](https://docs.julialang.org/en/v1/manual/profile/#Line-by-Line-Allocation-Tracking) this causes Julia to measure allocation for each line of executed code.

---

<div class="post-metadata">

### Author: ![johnb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnb/32/44115_2.png) [@johnb](https://discourse.julialang.org/u/johnb)
#### Post date: [November 22, 2024, 3:21pm UTC](https://discourse.julialang.org/t/performance-issue-in-vs-code-repl-70x-slower-was-wrong-setting/122910/8 "2024-11-22T15:21:26Z")

</div>

That fixed it! I don’t even remember why I had that flag turned on! Thanks a lot!

```julia
BenchmarkTools.Trial: 10000 samples with 981 evaluations.
 Range (min … max): 61.672 ns … 231.498 ns ┊ GC (min … max): 0.00% … 0.00%
 Time (median): 64.322 ns ┊ GC (median): 0.00%
 Time (mean ± σ): 67.838 ns ± 11.784 ns ┊ GC (mean ± σ): 0.00% ± 0.00%

   ▆█▇▄▂▁▁ ▁ ▁
  █████████████▇▇▇▆▆███▇▇▇▆▅▆▅▆▅▇▆▆▅▆▅▅▄▅▄▄▅▅▅▆▅▆▄▄▆▇▄▅███▇▇▆▇ █
  61.7 ns Histogram: log(frequency) by time 119 ns <

 Memory estimate: 0 bytes, allocs estimate: 0.

```
