Skip to content

"Extension causes high cpu load" warning at startup for slow filesystems and large folders #1819

Closed

Description

@jordanlesson
  • Issue Type: Performance
  • Extension Name: dart-code
  • Extension Version: 3.1.0
  • OS Version: Darwin x64 17.7.0
  • VSCode version: 1.35.1

⚠️ Make sure to attach this file from your home-directory:
⚠️/Users/jordanlesson/Dart-Code.dart-code-unresponsive.cpuprofile.txt

Find more details here: https://github.com/Microsoft/vscode/wiki/Explain:-extension-causes-high-cpu-load

Activity

  1. DanTup commented on Jun 25, 2019

    @DanTup
    Member

    ⚠️ Make sure to attach this file from your home-directory:
    ⚠️/Users/jordanlesson/Dart-Code.dart-code-unresponsive.cpuprofile.txt

    Thanks for the report, but you need to attach this file for this to be investigated.

    If you saw the issue at startup, I suspect it's #1628 which is fixed for the next version (which you can try out a beta release of from https://github.com/Dart-Code/Dart-Code/releases).

  2. added
    awaiting infoRequires more information from the customer to progress
    on Jun 25, 2019
  3. Ero-Raghav commented on Jun 29, 2019

    @Ero-Raghav
  4. DanTup commented on Jul 8, 2019

    @DanTup
    Member

    @Ero-Raghav how many folders are in the top 3 levels of your project? And how fast is your machine/disk?

    Your profile shows it sometimes taking 100ms to check a folder on disk, and we do this quite a lot while scanning looking for Dart/Flutter projects. It quickly adds up to 3 seconds, which causes VS Code to show this message (which is slightly misleading - it's not high CPU, it's time spent blocking the thread on I/O).

  5. DanTup commented on Jul 9, 2019

    @DanTup
    Member

    I did some testing on a folder that contains 1088 projects in the top 3 levels, but my times are so fast it's hard to optimise. I tried several other options (including making the search parallel/async and using the glob package) but they were all much slower.

    I'll investigate removing some exists checks which did have an improvement, but I'll need more info about your setup to do much more (things that are likely to be a factor are the number files/folders in the top 3 levels of the folder you opened in VS Code, the speed of your filesystem, and whether the filesystem may have been under load while this was happening).

    Screenshot 2019-07-09 at 11 51 51 am

  6. added a commit that references this issue on Jul 9, 2019
  7. Ero-Raghav commented on Jul 10, 2019

    @Ero-Raghav

    @DanTup

    It may be possible that it's because of slow HDD, because i never got this problem on my other system which have relatively faster HDD.

  8. DanTup commented on Jul 10, 2019

    @DanTup
    Member

    What sort of disk is in the one this occurred on? Is the machine generally really slow to use? I'd like to support as many machines as possible, but the numbers in that trace seem particularly slow (in my test above I scanned thousands of folders to find 1088 projects in 88ms, but your trace shows individual file-exists checks taking over 100ms).

  9. Ero-Raghav commented on Jul 10, 2019

    @Ero-Raghav

    its ATA Hitachi HTS72503 320GB HDD, and Yes its Generally slow to use (mostly when i am using vs-code) because of CPU bottleneck.

  10. DanTup commented on Jul 10, 2019

    @DanTup
    Member

    And how big is the folder you're opening? (how many folders at the top, 2nd, 3rd levels?).

  11. Ero-Raghav commented on Jul 10, 2019

    @Ero-Raghav

    around 1.3 GB and there are 16 folder at top level and level 2 and 3 have variable number of folders ranging from 4 to 40

  12. DanTup commented on Jul 10, 2019

    @DanTup
    Member

    Ok, it does at least seem like it may have had a lot of folders to scan. I'd prefer not to make this code async just to avoid this warning (since it gets slower for everyone) if it's only on slow machines and large folders. I think either you could ignore the message (it's not causing any harm - and despite the text, it's not using high CPU) or try to open smaller portions of your tree.

    I will try to eliminate some of the redundant exists checks though, that should help a little.

  13. changed the title [-]Extension causes high cpu load[/-] [+]"Extension causes high cpu load" warning at startup for slow filesystems and large folders[/+] on Jul 10, 2019
  14. added this to the v3.3.0 milestone on Jul 10, 2019
  15. added and removed
    awaiting infoRequires more information from the customer to progress
    on Jul 10, 2019
  16. added a commit that references this issue on Jul 10, 2019
  17. DanTup commented on Jul 10, 2019

    @DanTup
    Member

    I managed to shave around a third of the time off (on my machine) by using withFileTypes to avoid the extra exists+stat checks:

    Screenshot 2019-07-10 at 11 53 25 am

    This should improve things but if you (or anyone else) seems to hit this on reasonable disks and/or with fairly small folders, please do shout!

  18. Ero-Raghav commented on Jul 11, 2019

    @Ero-Raghav

    @DanTup Thank You

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions