10X build speed improvement


#1

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
}

Meteor 1.5 update: has error on build
Any tips on optimizing rebuild speeds?
[Solved] Build times unreasonably long
#2

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


#3

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.


#4

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:


#5

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.


#6

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.


#7

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…


#8

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.