10X build speed improvement

With Meteor 1.5 I had noticed a couple of problems:
Issues #8801, #8614, #8485 and #8803.

The issues have been resolved for me with the fix defined in #8801 (copied below) and I am now seeing build speeds that are extraordinarily fast and I can now experience the work that @benjamn has put into the build performance without issues.

Big thanks to bouchepat.

Summary

Environment: Windows 10 with Defender running
Editor: Visual Studio Code

Issues

Defender was analyzing every file emitted by the build because I run with Real-time protection on. I excluded my build drives from analysis by Defender Real-time protection. Check.

Visual Studio Code was analyzing my build directories for search index building and for the watcher to kick off other analysis. This turned out to be big. As a simple test simply kill your editor before you build. If you see a difference then your settings need to be tweaked. I turned both of them off. Check.

I installed 1.5.1.beta.Check.

The editor fixes apply to any build environment, obviously Defender fixes help windows only. If you run an antivirus real-time protection you can modify your tool appropriately.

I have never seen the build run so fast!! Feels like 10X to me. I feel cheated that I did not figure this out sooner :tired_face:.

Comment from issue #8801


4 things:

  1. Windows Defender can exclude folders from running the real time protection. You must be running as administrator to access it.
  2. In addition to folders, Windows Defender can exclude processes. I excluded node.exe.
  3. Meteor 1.5.1 has a fix on the way. Running the latest 1.5.1 beta will pull that fix in.
  4. Make sure your editor excludes build directories for search and for watching. Below are my VS Code exclusions. (Note: I stopped and restarted VSCode after updating these parameters, just to make sure they took).

VS Code Exclusions

"search.exclude": {
    "**/node_modules": true,
    "**/bower_components": true,
    "**/.meteor": true
},
"files.watcherExclude": {
  "**/.git/objects/**": true,
  "**/.git/subtree-cache/**": true,
  "**/node_modules": true,
  "**/bower_components": true,
  "**/.meteor": true
}
11 Likes

After some more experimentation I found that my exclusion directories need to be .meteor not .meteor\local. Updated my original post.

OK, Visual Studio Code had an issue that was also causing issues. The issue #30723 is now resolved in VS Code 1.14.2.

Since updating to v1.14 I have seen significant improvement and with VS Code 1.14.2 the VS processes are really low CPU usage.

Aww, I was excited for a moment, but that’s really more like “I solved my 10X slower build speed issue” :stuck_out_tongue:

Probably good information for Windows users though :+1:

1 Like

Correct, I was no longer stubbing my toe and it feels much better. :rofl:

The guidance to exclude the anti-virus and the make sure the editor file watching is ignoring build directories is good for any/all OSes.

I imagine build directory is something like appdata/local/.meteor. Also is there a way to increase polling rate of windows watcher, longform docs suggest sticking bashrc in some home directory with METEOR_WATCH_FORCE_POLLING=(time), only that sticking 30 seconds in there from https://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10 does nothing, and bashrc I think is linux only, as much as longform documentation intended for it to be- the docs.

Actually, the build directory is the one in your project, found at .meteor\build.

Why are you trying to increase the rate of the Meteor windows watcher? This would affect the rebuild of meteor not the other monitoring…

It claims that the default is 5 seconds, which means on the wrong end of the timer it will take 5 seconds before rebuild begins, which I belief it absolutely legit claim as it will take forever for refresh/restart to begin on windows compared to unix systems that have “events” for file change.

@janat08, BTW: I believe the way it works on windows is this:

During a development session, the watcher polls for changes once every 5 seconds. If a file is changed a rebuild will occur, but then the watcher knows that you are editing that file so it puts it into a faster loop. Subsequent changes to that file are very quickly recognized.

Which actually causes a problem. https://github.com/meteor/meteor/issues/9896 which has been addressed in v1.7: https://github.com/meteor/meteor/pull/9911#pullrequestreview-123587003

I thought I should update this thread because I have been using WSL and I see great performance from WSL. In order for the speed to be good I had to modify my Defender exclusions:

You can see a few things in this list:

  1. I exclude the WSL rootfs.
  2. E:\ & F:\ are my development only drives. E:\ is an SSD drive, so it is very fast.
  3. exclude bash.exe & node.exe.
  4. code.exe & codehelper.exe are running in support of VSCode, my editor.

It is also key to put exclusions into the editor. VSCode had a bug that caused an issue with exclusions when I first started this topic. The bug has long since been repaired. Here are my exclusion settings for VSCode:

    "files.watcherExclude": {
      "**/.git/objects/**": true,
      "**/.git/subtree-cache/**": true,
      "**/node_modules": true,
      "**/bower_components": true,
      "**/dist": true,
      "**/.meteor/local": true
    },
    "files.exclude": {
      "**/.git": true,
      "**/.meteor/local": true,
      "**/dist": true,
      "*.map": true
    },
2 Likes