Skip to content

Malwarebytes doubles VS Code startup time #18514

Closed

Description

Hey, I was going to report an issue with a slower VS Code recently, but then I found the cause & am reporting it to you.

Basically, I recently noticed that startup time went up from ~2-3 seconds to ~6-7 seconds. More annoyingly, I usually start VS Code by searching for it in Start Menu & pressing Enter or left click. However, VS Code turned into the one application that upon starting from Start Menu would freeze the Start Menu for another 1-2 seconds. Normally, Start Menu closes instantly, and VS Code was the one app causing such odd behavior.

After playing around, I tracked down the issue - I recently installed Malwarebytes and keep it running in the background. Whilst it is turned on, VS Code is much slower. When I turn Malwarebytes off, VS Code returns to starting very quickly & Start Menu closing instantly,

I wonder if reporting this symptom could be useful to you & if something could be done about it in some future version (unless it's just me :) ) .

Activity

  1. soyeyalon commented on Jan 13, 2017

    @soyeyalon

    Stoyan Berov (@stoberov) The issue might be with VSCode but you may want to contact Malwarebytes support and/or post this at their forum.

    You can try and add VSCode to your exclusion list.

    p.s. You may want to post additional information such as VSCode version, OS and extension list (if any).

  2. added
    upstream
    on Jan 16, 2017
  3. bpasero commented on Jan 16, 2017

    @bpasero
    Contributor

    Likely nothing we control on our end, best to report to them and see what they have to say. We can leave this open to discuss the results of that investigation.

  4. PowerWeb5 commented on Mar 7, 2017

    @PowerWeb5

    I also identified Malwarebytes as being the biggest factor in 10.5 second VS Code startup times, as discussed in #15455.
    However, I have identified a workaround:

    Workaround for Malwarebytes Slow Startup Time:

    In Malwarebytes Anti-Malware, under Settings > Protection, change the following settings:

    1. Disable "Enable self-protection module" under Startup Options
    2. Disable "Ransomware Protection" under Real-time Protection

    Doing this brought startup time down from 10.5 seconds (even with Webroot antivirus disabled) to 3.2 seconds, even with all other Real-time Protection enabled for Malwarebytes and Webroot.

    No other settings or exclusions made any appreciable difference, such as when I tried adding exclusions for VSCode folders including .vscode, Program Files, and Roaming, as well as Web Application Process for the .exe and under Managed Protected Applications.

    Disabling those 2 features resulted in:

    1. Deleting "MBAMFarflt " service, an FS driver in group "FSFilter Content Screener"
    2. Disabling MBAMChameleon" service, an FS driver in group "FSFilter Activity Monitor"

    It suspect those may have been slowing down disk access, with the many files that VSCode accesses on startup. In any case, disabling those features might also improve disk access performance in general.

  5. PowerWeb5 commented on Mar 7, 2017

    @PowerWeb5

    Johannes Rieken (@jrieken) Benjamin Pasero (@bpasero)

    I agree that Malwarebytes has an issue they need to optimize, with Self-Protection and Ransomware Protection features resulting in a far greater performance impact than all the others put together (at least in terms of VS Code startup time).

    However, I also benchmarked startup time with and without those features with other applications, such as Notepad++ (.7s startup time, opening the same file as I tested VS Code with) and OneNote (1.72 s startup time), and so no appreciable difference in startup time with or without those features disabled.

    Accordingly, it seems like VS Code startup time could still greatly benefit from optimized startup time, such as by delaying (until after the document is shown) or deferring (JIT) initialization of features and extensions, and the many files it seems to access on startup.
    VS Code startup time with those features enabled was 10.5 seconds (+/- 0.1 s). Unlike the perf profiling (which I also performed with and without extensions and with and without Insiders build).

    This was measured with a stopwatch to determine the "effective" startup time from the user's perspective - that is, until the document is displayed and readable (and before spellcheck underlining, detection of file content type, etc. finishes) - which I would consider more important than what the logged startup time (though useful for debugging). I was within 0.1s each time with stopwatch profiling across 20+ tests.

    These benchmarks are with non-Insiders build, with a few extensions enabled. However, tests with and without Insiders build and with and without extensions enabled didn't show much difference in results.

    These benchmarks are with high-end system specs (Intel Core™ i7-6700HQ, PCIe® NVMe™ M.2 SSD, 16GB RAM, Win 10 x64) with fastest SSD (and no other HDDs), and with nothing else running at the time. However others with slower disks or various anti-virus services enabled may encounter issues similar to what is seen when some Malwarebytes AV features are enabled - even without having Malwarebytes specifically.

    You can see this in how, whether those anti-virus features were enabled made no difference in Notepad++ and OneNote startup times, which were 0.7 seconds and 1.7 seconds respectively, and how VS Code still takes 3.3 seconds to open, which is nearly 5x Notepad++ (with many plugins enabled) and nearly 2x OneNote (which I would have thought would take longer to open, especially with web hosted/synced/shared Notebooks).

    I believe that VS Code having 10.5 second startup time when these features are enabled (such as due to access of many files before document can be displayed) and 3.2 seconds with no AV (with Malwarebytes and Webroot entirely disabled, and services disabled) compared to 1.7 s with OneNote and .7 seconds with Notepad++ points out that something within VS Code should change.

    Specifically, I would suggest deferring extension and feature loading until after the opened document is displayed (similar to what is done with spellcheck underling and content/code language determination being delayed until after that). Also, allowing VS Code to startup with windows and be minimized/closed to tray, as proposed in #11723, may prove a useful workaround or potentially even useful long-term.

  6. PowerWeb5 commented on Mar 7, 2017

    @PowerWeb5

    Here is a screenshot of the Startup Performance Measurement in the Console - as well as full log file - after starting up with the --performance flag (not used earlier) with the same Test.txt document used for above benchmarks, for the latest release build of VS Code.
    I have Webroot running and Malwarebytes, but with the slow Malwarebytes features (Self-protection and Ransomware Protection) disabled. I have a few extensions enabled, but they don't make much of a difference in startup time.
    This corresponds to the manually (stopwatch) benchmarked 3.4 second startup time (time until document contents are shown).

    vs code startup measurement - malwarebytes without self protection or ransomware

    VS Code Startup Measurement - Malwarebytes without Self Protection or Ransomware.log.txt

    I have the following extensions enabled (though disabling makes no difference in startup time until document contents are displayed) and config info generated for F1 > Help: Report Performance Issue:

    Extensions and Version Details:

    • VSCode Version: Code 1.10.1 (653f873, 2017-03-02T00:33:15.706Z)
    • OS Version: Windows_NT ia32 10.0.14393
    • Extensions:
    Extension Author Version
    livs abhiagr 1.0.3
    regex chrmarti 0.0.8
    xml DotJoshJohnson 1.7.0
    code-runner formulahendry 0.6.13
    ExtensionUpdateCheck HookyQR 0.0.2
    mssql ms-mssql 0.3.0
    csharp ms-vscode 1.7.0
    PowerShell ms-vscode 0.9.0
    qub-msbuild qub 0.5.0
    vba spences10 1.0.16
    code-spell-checker streetsidesoftware 0.17.2
  7. PowerWeb5 commented on Mar 7, 2017

    @PowerWeb5

    Here is the Startup Performance Measurement under same conditions described above, except also with --disable-extensions:

    vs code startup measurement - malwarebytes without self protection or ransomware - disable extensions
    VS Code Startup Measurement - Malwarebytes without Self Protection or Ransomware.log.txt

  8. PowerWeb5 commented on Mar 8, 2017

    @PowerWeb5

    This is the Startup Performance Measurement with Malwarebytes Self-Protection and Ransomware Protection enabled, and extensions enabled, which took 10.9 seconds until the content of the Test.txt document VS Code was started up with was displayed and readable This is under the same conditions as the 10.5 second benchmark described earlier, but with --performance startup flag.
    I included logged warnings before the Measurement output as well in this screenshot.

    vs code startup measurement - 10 9s startup with malwarebytes with self protection or ransomware enabled
    VS Code Startup Measurement - 10.9s startup with Malwarebytes WITH Self Protection or Ransomware Enabled.log.txt

  9. PowerWeb5 commented on Mar 8, 2017

    @PowerWeb5

    Same as previous, but with --extensions-disabled, which made no difference, as still took 10.9 seconds to display the document contents.

    This is the Startup Performance Measurement with Malwarebytes Self-Protection and Ransomware Protection enabled, and extensions DISABLED, which took 10.9 seconds until the content of the Test.txt document VS Code was started up with was displayed and readable.
    This is under the same conditions as the 10.5 second benchmark described earlier, but with --performance startup flag.

    
    Startup Performance Measurement
    OS: win32 (10.0.14393)
    CPUs: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz (8 x 2592)
    Memory (System): 15.96GB (9.62GB free)
    Memory (Process): 111.88MB working set (196.03MB peak, 95.22MB private, 25.86MB shared)
    VM (likelyhood): 0%
    Initial Startup: true
    Screen Reader Active: false
    Empty Workspace: true
    

    This brings me to a separate issue:

    Unrelated Issue:

    Above is the entire contents of the Dev Tools Console. As you can see, the timing details are missing randomly in cases, but it seems like may occur more often with --disable-extensions.

    Because of this I didn't bother including a screenshot or log file. This occurred twice in a row and had the same startup time as with extensions enabled in any case, and I reported details with extensions disabled (but without Malwareware features enabled, so much faster in that case) earlier, if needed.

    Steps to Reproduce:

    Sometimes when I perform F1 > Developer Startup Performance (in these cases, after having --performance and a document path as command line args, if relevant), the Developer Tools console only, without the array of timings (for renderer, etc.), and also without any other warnings or log contents. That happened this time, so I had to repeat a few times until randomly I got the full timing output.

  10. bpasero commented on Mar 8, 2017

    @bpasero
    Contributor

    I am closing this and ask people that hit slow performance to run code-insiders --prof-startup (from our insiders build: http://code.visualstudio.com/Download#insiders) which now supports to run CPU profiles so that we can have a closer look. Running with this argument will guide you through the process of creating a performance report.

  11. jrieken commented on Mar 8, 2017

    @jrieken
    Contributor

    The slow startup because of AV software is an issue with electron. Other apps (Atom, Slack, et al) suffer from this as well: electron/electron#1487.

  12. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

perfupstream

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions