Skip to content

Commit e27ae04

Browse files
authored
Merge pull request #74 from MariusDrulea/master
Documentation for fast debugging
2 parents b664567 + a73db8a commit e27ae04

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

docs/src/assets/debugger/16.png

241 KB
Loading

docs/src/assets/debugger/17.png

4.12 KB
Loading

docs/src/assets/debugger/18.png

40.2 KB
Loading

docs/src/assets/debugger/19.png

50.6 KB
Loading

docs/src/userguide/debugging.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,42 @@ Your code will run a lot faster with this option enabled.
109109

110110
### Troubleshooting
111111
If you encounter any issue when using the debugger, Please do let us know about it over at the [Julia VS Code](https://github.com/julia-vscode/julia-vscode) repository.
112+
113+
114+
## Settings to speed-up the debugger
115+
### `ALL_MODULES_EXCEPT_MAIN`
116+
In order to make the debugger run faster we want to minimize the number of packages/modules which are interpreted.
117+
Let's say you need to debug the code you wrote, but also the functionality provided by the package Statistics.
118+
Click on the Debugger Default Compiled extension setting.
119+
120+
![Debugger](../assets/debugger/16.png)
121+
122+
Configure this setting as follows.
123+
```
124+
"julia.debuggerDefaultCompiled": [
125+
"ALL_MODULES_EXCEPT_MAIN",
126+
"-Statistics.",
127+
]
128+
```
129+
`ALL_MODULES_EXCEPT_MAIN` will make all modules run in compiled mode except the Main module, which contains the code you wrote. We also use "-Statistics." to remove this module and all its submodules from the list of compiled modules, such that it will be interpreted.
130+
131+
### Use a custom sys image
132+
Custom julia sys images can also be used when debugging. Go to julia-vscode extension settings and click to edit "Additional Args".
133+
134+
![Debugger](../assets/debugger/17.png)
135+
136+
137+
Once in the settings, use "-J" option followed by your path to the custom sys image. Note this "Additional Args" settings are currently used only when debugging in the REPL mode, see the `@run` macron in the example bellow.
138+
```
139+
"julia.additionalArgs": [
140+
"-JC:\\temp\\sys_custom.so",
141+
],
142+
```
143+
### Example for fast(er) debugging
144+
In the following code we use the packages GLMakie and Statistics. GLMakie is a plotting package and it's known to have a pretty slow time-to-first-plot(TTFP), especially for julia versions older than 1.9. Interpretting GLMakie is definetely not a thing we want to do when debugging. With the settings above, GLMakie is set to run in compile mode and we also load it from the sys image. Make sure you use the `@run` macro with your root function and debugg in the REPL mode.
145+
146+
![Debugger](../assets/debugger/18.png)
147+
148+
As the debugger hits the desired line of code we can step inside the `mean` function (Statistics) and debug there.
149+
150+
![Debugger](../assets/debugger/19.png)

0 commit comments

Comments
 (0)