VSCode slow to open and highlight large log files - visual-studio-code

VSCode slow to open and highlight large log files
I use VSCode to open large log files with the log highlighter syntax. These log files are very large, often a couple hundred megabytes. I switched from Notepad++ to VSCode for all the features. Notepad++ usually opened the files okay but lacked the highlighting benefits.
The new VSCode updates asked me to increase memory size which I quadrupled.
However some logs either take a while to highlight or never do at all.
Is there anyway to either speed this up or get this to work a bit better? Should I open a github issue?
I would really like to use VSCode for these logs but it is annoying...
Resources on PC are not an issue.

Related

Re-disable extensions for large files

I saw when I tried to open an 80MB txt file that some features were disabled to prevent crashes or not. I accidentally clicked forcibly reenable extensions but now vscode is extremely laggy when I try to browse the file.
Does anyone know how to re-disable those extensions like tokenization when opening large files again?
Try disabling this setting:
Editor: Large File Optimizations
Special handling for large files to disable certain memory-intensive features.

Keeping files in cache VSCode/Prevent erase after closing

I recently moved to VSCode from Notepad++, and I just found an annoying difference.
When I had for example n files opened in Notepad++ and I closed it(also if restarting computer), when re-opening it I used to find those files again, also if they were deleted from folder or edited.
In VSCode, just some files are keeping opened(it depends if you have got them locally or download once and then delete or refresh them), and that's an annoying thing for me.
I guess this function is related to cache system, so I am wondering: Is there any method to make the VSCode cache work like Notepad++'s does in VSCode? Are there any extensions to do it?
I mean: to keep files always in cache, except when I close them.
Thank you in advance

Prevent VS Code from opening all files in a folder recursively

I am currently using VS Code on a folder mounted through an SSHFS. The folder has subfolders with many jpg and other image files.
Logging all the files VS Code tries to open reveals it recursively touches all the files (doesn't read the content, just STATs them). This takes very, very long over an SSHfs mount and I can not cancel it without killing the editor (it won't even respond to regular closing).
During this, no files or directories can be opened (inside VSCode) and will show a loading spinner until VS Code has finally had it's way and checked all the files.
This behaviour only recently emerged, I can't pinpoint if any version beyond the current stable version has this behaviour.
I am thinking it might be the new searching engine, but I can't find out which part of the editor is doing it.
It looks like they just posted a fix for your situation:
Slow startup opening a large workspace over the network
you will need vscode v1.32.3

Why does VS Code require so much memory? How can I make it run more memory-efficiently?

Does anyone know how to make VS Code use less memory?
It´s taking more than 2gb, sometimes more than 3 gigabytes to have some 8 files opened.
I'm on the VS code team.
There are many possible causes for high memory usage. We've put together tools and a guide that can help you investigate potential performance issues.
Start by using the process explorer. The process explorer shows the cpu and memory usage per child process of VS Code. Open it with the Open process explorer command. The process explorer should help you track down which processes are using the most memory. Often times, an extension will turn out to be the root cause
Also, even though you have only opened eight files, your workspace seems to be quite a bit larger than just those eight. Providing intellisense and other advanced editor features often requires processing many unopened files as well. Whether or not the 2-3gb is justified or not is hard to say without understanding what extensions you are using and what your workspace contains.
I recommend that you also take a look through the rest of our performance issue guide. It explains how to report performance issues and further investigate performance problems.
You could prevent vscode from watching folders with really many files in you project by adding this to your json settings file
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/node_modules/**": true
}
It's because VS Code isn't a native program like Vim, Emacs, or even Sublime. Opening VS Code is like opening another Chrome window, it uses a lot of RAM, and CPU.
Neovim uses around 10 mbs of RAM (with some plugins), while vs code uses 700 mbs of RAM, with no file opened
Because VSCode is built on top of Electron, so under the hood it is just the same as web browser.
If you need more lighter memory use Sublime Text or Notepad++ instead
Check if your extensions are causing the bad things
I have used the guide https://github.com/Microsoft/vscode/wiki/Performance-Issues#profile-the-running-extensions
to know why VS Code was
very slow to startup
taking much ram (3-4 gb)
You can create a CPU profile and share it in the issue with the extension author or us. To create a CPU profile:
Close all instances of VSCode and start with code --inspect-extensions=9993 or any other port number.
Execute the Developer: Show Running Extensions Command. This command opens an editor with all the running extensions. To start recording a profile
I found some extension with high delays and they were marked with unresponsive yellow triangle. I disabled them using right click context menu, restarted VS Code, and after that it
Takes only a few seconds to startup
Takes only ~250mb of ram
Not an actual solution, but launching VSC via code ./ --disable-extensionscan do so without requiring to manually disable all of them.

Is drag-and-drop to open a file possible in VSCode?

I am wondering if something is wrong with my computer (or myself), because I can't seem to drag & drop a file into Visual Studio Code to open it in the editor. Closing an opened folder first doesn't make a difference. VSCode always shows me the 'stop sign', in every spot I tried (the editor, the opened tab bar, an existing opened file, ...).
Why does VSCode block this ?
(I have experienced this in earlier versions as well. Currently on v1.6 on Windows 7.)
Searching for a solution, I stumbled on this page, where one commenter explains:
I think you are running into the security issue where lower permission processes cannot send messages to higher permission processes. Explorere.exe, running at normal permission levels, cannot send the window message to winword.exe, running elevated.
I am indeed always running VSCode as Administrator, but not my Explorer windows.
When I run VSCode in non-administrator mode (so just my regular user), drag-and-drop works fine.
I feel silly as I lost 15 minutes looking into this. In case it helps:
Make sure you are not trying to open files from a zip file...
Cheers.