Long build time

I’m trying to figure out why it takes ~9 minutes for our meteor app to build on our servers. I ran a build locally and profiled it to get more information about what was going on. Using Meteor 1.9.3. Here are the top offenders from the profiler:

Top leaves:
| other Target#minifyJs..................................168,270 ms (2)
| plugin aas395:angular-compilers.........................41,120 ms (9)
| files.readFile..........................................29,838 ms (101968)
| files.writeFile.........................................13,837 ms (46614)
| other ImportScanner#findImportedModuleIdentifiers.......13,382 ms (2594)
| other Builder#copyNodeModulesDirectory..................11,103 ms (28)
| files.stat...............................................8,641 ms (168407)
| files.watchFile..........................................7,704 ms (379053)
| files.lstat..............................................4,598 ms (55620)
| other safeWatcher.watch..................................3,602 ms (377495)
| other PackageSource#_findSources.........................3,101 ms (3)
| other compileUnibuild (the app)..........................2,430 ms (3)
| sha1.....................................................1,906 ms (55305)
| CssTools.minifyCss.......................................1,616 ms (2)
| other ImportScanner#resolve..............................1,406 ms (13920)
| other optimistic hashOrNull..............................1,152 ms (47373)

I don’t have much of a sense for what normal build times look like, but this seems very long to me. Does anyone have any thoughts about where we might be going wrong here? Here’s my packages file:

meteor-base@1.4.0             # Packages every Meteor app needs to have
mobile-experience@1.0.5       # Packages for a great mobile UX
mongo@1.8.0                   # The database Meteor supports right now
reactive-var@1.0.11           # Reactive variable for tracker
tracker@1.2.0                 # Meteor's client-side reactive programming library

standard-minifier-css@1.6.0   # CSS minifier run for production mode
es5-shim@4.8.0               # ECMAScript 5 compatibility for older browsers
ecmascript@0.14.2              # Enable ECMAScript2015+ syntax in app code
shell-server@0.4.0            # Server-side component of the `meteor shell` command

accounts-password@1.5.2
aldeed:collection2
alanning:roles@1.2.19
edgee:slingshot
peerlibrary:aws-sdk
momentjs:moment
session@1.2.0
aldeed:moment-timezone
email@1.2.3
underscore@1.0.10
http@1.4.2
reywood:publish-composite
percolate:migrations
standard-minifier-js@2.6.0
nimble:restivus
simple:rest
simple:json-routes
aas395:angular-compilers

and my package.json production dependencies:

"@aas395/numjs": "^0.16.3",
    "@angular/animations": "^7.2.13",
    "@angular/cdk": "^7.3.7",
    "@angular/common": "^7.2.13",
    "@angular/compiler": "^7.2.13",
    "@angular/core": "^7.2.13",
    "@angular/forms": "^7.2.13",
    "@angular/http": "^7.2.13",
    "@angular/platform-browser": "^7.2.13",
    "@angular/platform-browser-dynamic": "^7.2.13",
    "@angular/router": "^7.2.13",
    "@babel/runtime": "^7.4.3",
    "@bluemath/linalg": "^0.2.2",
    "@fortawesome/angular-fontawesome": "^0.3.0",
    "@fortawesome/fontawesome-free": "^5.8.1",
    "@fortawesome/fontawesome-svg-core": "^1.2.17",
    "@fortawesome/free-brands-svg-icons": "^5.8.1",
    "@fortawesome/free-regular-svg-icons": "^5.8.1",
    "@fortawesome/free-solid-svg-icons": "^5.8.1",
    "@ng-bootstrap/ng-bootstrap": "^4.1.1",
    "@zxing/ngx-scanner": "^1.3.0",
    "aws-sdk": "^2.648.0",
    "bcrypt": "^3.0.8",
    "core-js": "^3.0.1",
    "install": "^0.12.2",
    "jstz": "^2.1.1",
    "kjua": "^0.4.0",
    "meteor-node-stubs": "0.4.1",
    "meteor-rxjs": "0.4.14",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.23",
    "ngx-device-detector": "^1.3.5",
    "ngx-kjua": "^1.3.2",
    "rxjs": "^6.4.0",
    "sha.js": "^2.4.11",
    "sharp": "^0.23.2",
    "simpl-schema": "^1.5.5",
    "textarea-caret": "^3.1.0",
    "three-full": "git://github.com/mattmm3d/three-full.git#dev",
    "tsickle": "^0.34.3",
    "twilio": "^3.41.1",
    "web-animations-js": "^2.3.1",
    "xml2js": "^0.4.19",
    "zone.js": "^0.8.29",
    "typescript": "^3.3.4000"

Thank you for any thoughts you can provide!

It would be easier to know what is happening if you show the full profile. I am not familiar with aas395:angular-compilers, but everything else looks mostly normal for the recent versions of Meteor. To clarify, this is from running meteor build?

An easy improvement would be from replacing standard-minifier-js with zodern:standard-minifier-js@4.0.0-beta.4. It uses caching to avoid minifying files that haven’t changed.
Also, setting the env var METEOR_DISABLE_OPTIMISTIC_CACHING=1 when running meteor build should save a few seconds.

Thank you so much for your quick response!

That angular compilers package is the same as angular-compilers but with a minor change to allow us to import our own scss files.

I added your package (looks better already) and here’s the full output from METEOR_PROFILE=100 AOT=1 METEOR_DISABLE_OPTIMISTIC_CACHING=1 meteor build --directory /tmp/build-test

| (#1) Profiling: meteor build                
Warning: Nested Profile.run at ProjectContext prepareProjectForBuild
[client]: Collecting TypeScript source files: 8.243ms
TypeScript Host Created.: 0.306ms
TypeScript Program Created.: 3189.917ms
Angular Compiler Host Created.: 0.370ms
Angular Compiler Program Created.: 335.726ms
Filtering TypeScript source files: 0.564ms
Modules Analyzed.: 4482.683ms
Emitting All Impls: 4587.075ms
Modules Converted to TypeScript.: 521.642ms
client/imports/app/aim-utilities/components/patient-invite/patient-invite.component.ngfactory.ts (162, 15): Expected 0 arguments, but got 2.
[client]: TypeScript Files Compilation: 240.551ms
[client]: HTML Files Compilation: 120.307ms
[client]: SCSS Files Compilation: 243.110ms
(node:96458) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
[client]: Collecting TypeScript source files: 9.733ms
TypeScript Host Created.: 0.405ms
TypeScript Program Created.: 2213.911ms
Angular Compiler Host Created.: 0.441ms
Angular Compiler Program Created.: 171.889ms
Filtering TypeScript source files: 0.284ms
Modules Analyzed.: 3342.229ms
Emitting All Impls: 4321.447ms
Modules Converted to TypeScript.: 358.709ms
client/imports/app/aim-utilities/components/patient-invite/patient-invite.component.ngfactory.ts (162, 15): Expected 0 arguments, but got 2.
[client]: TypeScript Files Compilation: 233.941ms
[client]: HTML Files Compilation: 65.762ms
[client]: SCSS Files Compilation: 233.113ms
[server]: Collecting TypeScript source files: 12.030ms
TypeScript Host Created.: 0.054ms
TypeScript Program Created.: 4532.069ms
Angular Compiler Host Created.: 0.043ms
Angular Compiler Program Created.: 217.055ms
Filtering TypeScript source files: 0.129ms
Modules Analyzed.: 4223.807ms
Emitting All Impls: 641.326ms
Modules Converted to TypeScript.: 0.758ms
[server]: TypeScript Files Compilation: 21.334ms
[server]: HTML Files Compilation: 0.027ms
[server]: SCSS Files Compilation: 0.047ms
|                                            -
| files.stat                                                        1 ms (3)
| files.readFile                                                    1 ms (3)
| require("meteor/socket-stream-client")                            1 ms (1)
| Npm.require("faye-websocket")                                    33 ms (1)
| Npm.require("permessage-deflate")                                 6 ms (1)
| meteor build................................................267,056 ms (1)
| β”œβ”€ ProjectContext prepareProjectForBuild......................5,338 ms (1)
| β”‚  β”œβ”€ _resolveConstraints.....................................1,376 ms (1)
| β”‚  β”‚  β”œβ”€ bundler.readJsImage....................................296 ms (1)
| β”‚  β”‚  β”‚  └─ meteorNpm.rebuildIfNonPortable......................240 ms (16)
| β”‚  β”‚  β”‚     └─ meteorNpm.isPortable.............................199 ms (206)
| β”‚  β”‚  β”‚        └─ optimistic readJsonOrNull.....................108 ms (206)
| β”‚  β”‚  β”‚           └─ optimistic readFile........................103 ms (206)
| β”‚  β”‚  β”‚              └─ files.readFile                          100 ms (206)
| β”‚  β”‚  └─ JsImage#load.........................................1,030 ms (1)
| β”‚  β”‚     β”œβ”€ runJavaScript packages/dynamic-import.js............186 ms (1)
| β”‚  β”‚     β”‚  └─ require("/node_modules/meteor/dynamic-import/server.js").185 ms (1)
| β”‚  β”‚     β”‚     └─ require("./security.js")                      183 ms (1)
| β”‚  β”‚     β”œβ”€ runJavaScript packages/npm-mongo.js.................285 ms (1)
| β”‚  β”‚     β”‚  └─ Npm.require("mongodb")                           281 ms (1)
| β”‚  β”‚     └─ runJavaScript packages/boilerplate-generator.js.....106 ms (1)
| β”‚  β”‚        └─ require("/node_modules/meteor/boilerplate-generator/generator.js") 103 ms (1)
| β”‚  β”œβ”€ _downloadMissingPackages..................................133 ms (1)
| β”‚  β”‚  └─ Isopack.readMetadataFromDirectory                      106 ms (90)
| β”‚  └─ _buildLocalPackages.....................................3,784 ms (1)
| β”‚     β”œβ”€ _ensurePackageLoaded(aas395:angular-compilers).......1,239 ms (1)
| β”‚     β”‚  β”œβ”€ _ensurePackageLoaded(ecmascript)....................444 ms (1)
| β”‚     β”‚  β”‚  β”œβ”€ IsopackCache Load local isopack..................207 ms (1)
| β”‚     β”‚  β”‚  β”‚  └─ Isopack#initFromPath..........................207 ms (1)
| β”‚     β”‚  β”‚  β”‚     └─ bundler.readJsImage........................203 ms (1)
| β”‚     β”‚  β”‚  β”‚        └─ meteorNpm.rebuildIfNonPortable..........194 ms (7)
| β”‚     β”‚  β”‚  β”‚           └─ meteorNpm.isPortable                 167 ms (169)
| β”‚     β”‚  β”‚  └─ _ensurePackageLoaded(babel-compiler).............202 ms (1)
| β”‚     β”‚  β”‚     └─ IsopackCache Load local isopack...............118 ms (1)
| β”‚     β”‚  β”‚        └─ Isopack#initFromPath.......................113 ms (1)
| β”‚     β”‚  β”‚           └─ meteorNpm.rebuildIfNonPortable          108 ms (1)
| β”‚     β”‚  β”œβ”€ _ensurePackageLoaded(angular-typescript-compiler)...257 ms (1)
| β”‚     β”‚  β”‚  └─ _ensurePackageLoaded(angular-scss-compiler)......176 ms (1)
| β”‚     β”‚  β”‚     └─ IsopackCache Build local isopack..............175 ms (1)
| β”‚     β”‚  β”‚        └─ Isopack#initFromPath.......................167 ms (1)
| β”‚     β”‚  β”‚           └─ meteorNpm.rebuildIfNonPortable..........162 ms (1)
| β”‚     β”‚  β”‚              └─ meteorNpm.isPortable                 146 ms (169)
| β”‚     β”‚  └─ IsopackCache Build local isopack....................496 ms (1)
| β”‚     β”‚     └─ Isopack#initFromPath.............................449 ms (1)
| β”‚     β”‚        └─ bundler.readJsImage...........................446 ms (1)
| β”‚     β”‚           └─ meteorNpm.rebuildIfNonPortable.............426 ms (12)
| β”‚     β”‚              └─ meteorNpm.isPortable....................377 ms (398)
| β”‚     β”‚                 β”œβ”€ files.stat                           133 ms (398)
| β”‚     β”‚                 └─ optimistic readJsonOrNull............211 ms (398)
| β”‚     β”‚                    └─ optimistic readFile...............203 ms (398)
| β”‚     β”‚                       └─ files.readFile                 200 ms (398)
| β”‚     β”œβ”€ _ensurePackageLoaded(accounts-base)....................411 ms (1)
| β”‚     β”‚  β”œβ”€ _ensurePackageLoaded(ddp)                           197 ms (1)
| β”‚     β”‚  └─ _ensurePackageLoaded(mongo)                         120 ms (1)
| β”‚     β”œβ”€ _ensurePackageLoaded(minifier-css).....................135 ms (1)
| β”‚     β”‚  └─ IsopackCache Load local isopack.....................135 ms (1)
| β”‚     β”‚     └─ Isopack#initFromPath.............................134 ms (1)
| β”‚     β”‚        └─ meteorNpm.rebuildIfNonPortable................125 ms (1)
| β”‚     β”‚           └─ meteorNpm.isPortable                       114 ms (132)
| β”‚     β”œβ”€ _ensurePackageLoaded(peerlibrary:aws-sdk)............1,259 ms (1)
| β”‚     β”‚  └─ IsopackCache Load local isopack...................1,256 ms (1)
| β”‚     β”‚     └─ Isopack#initFromPath...........................1,256 ms (1)
| β”‚     β”‚        β”œβ”€ files.open                                    286 ms (2354)
| β”‚     β”‚        β”œβ”€ files.read                                    781 ms (2354)
| β”‚     β”‚        └─ other Isopack#initFromPath                    145 ms
| β”‚     β”œβ”€ _ensurePackageLoaded(standard-minifier-css)............225 ms (1)
| β”‚     β”‚  └─ IsopackCache Load local isopack.....................225 ms (1)
| β”‚     β”‚     └─ Isopack#initFromPath.............................225 ms (1)
| β”‚     β”‚        └─ bundler.readJsImage...........................221 ms (1)
| β”‚     β”‚           └─ meteorNpm.rebuildIfNonPortable.............212 ms (11)
| β”‚     β”‚              └─ meteorNpm.isPortable....................189 ms (310)
| β”‚     β”‚                 └─ optimistic readJsonOrNull............125 ms (310)
| β”‚     β”‚                    └─ optimistic readFile...............120 ms (310)
| β”‚     β”‚                       └─ files.readFile                 119 ms (310)
| β”‚     └─ _ensurePackageLoaded(zodern:standard-minifier-js)......209 ms (1)
| β”‚        └─ IsopackCache Load local isopack.....................209 ms (1)
| β”‚           └─ Isopack#initFromPath.............................209 ms (1)
| β”‚              └─ bundler.readJsImage...........................206 ms (1)
| β”‚                 └─ meteorNpm.rebuildIfNonPortable.............182 ms (12)
| β”‚                    └─ meteorNpm.isPortable                    162 ms (183)
| β”œβ”€ bundler.bundle...........................................261,591 ms (1)
| β”‚  β”œβ”€ compiler.compile(the app)..............................23,585 ms (1)
| β”‚  β”‚  └─ compileUnibuild (the app)...........................23,584 ms (3)
| β”‚  β”‚     β”œβ”€ Isopack#ensurePluginsInitialized..................8,700 ms (36)
| β”‚  β”‚     β”‚  └─ JsImage#load...................................8,694 ms (5)
| β”‚  β”‚     β”‚     β”œβ”€ runJavaScript packages/modules.js.............121 ms (4)
| β”‚  β”‚     β”‚     β”‚  └─ require("/node_modules/meteor/modules/server.js").119 ms (4)
| β”‚  β”‚     β”‚     β”‚     └─ require("./reify.js")...................116 ms (4)
| β”‚  β”‚     β”‚     β”‚        └─ require("reify/lib/runtime")         114 ms (4)
| β”‚  β”‚     β”‚     β”œβ”€ runJavaScript packages/ecmascript-runtime-server.js.113 ms (4)
| β”‚  β”‚     β”‚     β”‚  └─ require("/node_modules/meteor/ecmascript-runtime-server/runtime.js").112 ms (4)
| β”‚  β”‚     β”‚     β”‚     └─ require("core-js/modules/es.symbol.async-iterator") 112 ms (4)
| β”‚  β”‚     β”‚     β”œβ”€ runJavaScript packages/fetch.js...............120 ms (3)
| β”‚  β”‚     β”‚     β”‚  └─ require("/node_modules/meteor/fetch/server.js").120 ms (3)
| β”‚  β”‚     β”‚     β”‚     └─ require("node-fetch")                   119 ms (3)
| β”‚  β”‚     β”‚     β”œβ”€ runJavaScript packages/minifier-css.js........357 ms (1)
| β”‚  β”‚     β”‚     β”‚  └─ require("/node_modules/meteor/minifier-css/minifier.js").346 ms (1)
| β”‚  β”‚     β”‚     β”‚     └─ require("/node_modules/meteor/minifier-css/node_modules/cssnano/dist/index.js") 257 ms (1)
| β”‚  β”‚     β”‚     β”œβ”€ runJavaScript packages/angular-html-compiler.js.109 ms (1)
| β”‚  β”‚     β”‚     β”‚  └─ require("/node_modules/meteor/angular-html-compiler/index.js").107 ms (1)
| β”‚  β”‚     β”‚     β”‚     └─ Npm.require("cheerio")                  107 ms (1)
| β”‚  β”‚     β”‚     β”œβ”€ runJavaScript packages/angular-scss-compiler.js.166 ms (1)
| β”‚  β”‚     β”‚     β”‚  └─ require("/node_modules/meteor/angular-scss-compiler/index.js").164 ms (1)
| β”‚  β”‚     β”‚     β”‚     └─ Npm.require("node-sass")                162 ms (1)
| β”‚  β”‚     β”‚     β”œβ”€ runJavaScript packages/angular-typescript-compiler.js.3,328 ms (1)
| β”‚  β”‚     β”‚     β”‚  └─ require("/node_modules/meteor/angular-typescript-compiler/index.js").3,309 ms (1)
| β”‚  β”‚     β”‚     β”‚     β”œβ”€ require("/node_modules/meteor/angular-typescript-compiler/node_modules/typescript/lib/typescript.js") 2,817 ms (1)
| β”‚  β”‚     β”‚     β”‚     └─ require("/node_modules/meteor/angular-typescript-compiler/rollup.js").432 ms (1)
| β”‚  β”‚     β”‚     β”‚        β”œβ”€ Npm.require("rollup")                197 ms (1)
| β”‚  β”‚     β”‚     β”‚        └─ Npm.require("rollup-plugin-commonjs") 209 ms (1)
| β”‚  β”‚     β”‚     └─ runJavaScript packages/Angular_Compilers_plugin.js.4,131 ms (1)
| β”‚  β”‚     β”‚        └─ require("/node_modules/meteor/Angular Compilers/plugin/register.js").4,129 ms (1)
| β”‚  β”‚     β”‚           β”œβ”€ require("@angular/compiler")............671 ms (1)
| β”‚  β”‚     β”‚           β”‚  └─ Npm.require("@angular/compiler")     671 ms (1)
| β”‚  β”‚     β”‚           └─ require("@angular/compiler-cli")......3,457 ms (1)
| β”‚  β”‚     β”‚              └─ Npm.require("@angular/compiler-cli") 3,457 ms (1)
| β”‚  β”‚     β”œβ”€ PackageSource#_findSources........................7,410 ms (3)
| β”‚  β”‚     β”‚  β”œβ”€ files.realpath                                   358 ms (10099)
| β”‚  β”‚     β”‚  β”œβ”€ files.stat                                     3,100 ms (260780)
| β”‚  β”‚     β”‚  β”œβ”€ files.readdir                                    642 ms (20198)
| β”‚  β”‚     β”‚  β”œβ”€ optimistic readJsonOrNull......................1,574 ms (3262)
| β”‚  β”‚     β”‚  β”‚  β”œβ”€ optimistic readFile.........................1,250 ms (3262)
| β”‚  β”‚     β”‚  β”‚  β”‚  └─ files.readFile                           1,237 ms (3262)
| β”‚  β”‚     β”‚  β”‚  β”œβ”€ safeWatcher.watch.............................179 ms (2408)
| β”‚  β”‚     β”‚  β”‚  β”‚  └─ files.watchFile                            106 ms (2408)
| β”‚  β”‚     β”‚  β”‚  └─ other optimistic readJsonOrNull               145 ms
| β”‚  β”‚     β”‚  └─ other PackageSource#_findSources               1,717 ms
| β”‚  β”‚     β”œβ”€ optimistic readFile...............................4,014 ms (23996)
| β”‚  β”‚     β”‚  └─ files.readFile                                 3,943 ms (23996)
| β”‚  β”‚     β”œβ”€ optimistic hashOrNull.............................2,053 ms (23996)
| β”‚  β”‚     β”‚  β”œβ”€ optimistic readFile............................1,436 ms (23996)
| β”‚  β”‚     β”‚  β”‚  └─ files.readFile                              1,385 ms (23996)
| β”‚  β”‚     β”‚  β”œβ”€ sha1                                             496 ms (23996)
| β”‚  β”‚     β”‚  └─ other optimistic hashOrNull                      121 ms
| β”‚  β”‚     └─ other compileUnibuild (the app)                   1,406 ms
| β”‚  β”œβ”€ bundler.bundle..makeClientTarget......................174,896 ms (2)
| β”‚  β”‚  └─ Target#make........................................174,896 ms (2)
| β”‚  β”‚     β”œβ”€ Target#_runCompilerPlugins.......................28,477 ms (2)
| β”‚  β”‚     β”‚  └─ plugin aas395:angular-compilers               28,367 ms (6)
| β”‚  β”‚     β”œβ”€ Target#_emitResources............................33,994 ms (2)
| β”‚  β”‚     β”‚  β”œβ”€ PackageSourceBatch.computeJsOutputFilesMap....32,797 ms (2)
| β”‚  β”‚     β”‚  β”‚  β”œβ”€ ImportScanner#realPath........................365 ms (2916)
| β”‚  β”‚     β”‚  β”‚  β”‚  └─ optimistic lstat...........................267 ms (14326)
| β”‚  β”‚     β”‚  β”‚  β”‚     └─ files.lstat                             246 ms (14326)
| β”‚  β”‚     β”‚  β”‚  β”œβ”€ ImportScanner#scanImports for ecmascript-runtime-client.783 ms (2)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”œβ”€ ImportScanner#findImportedModuleIdentifiers 297 ms (370)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”œβ”€ ImportScanner#resolve......................252 ms (1224)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  └─ files.stat                              153 ms (2034)
| β”‚  β”‚     β”‚  β”‚  β”‚  └─ ImportScanner#readFile.....................171 ms (367)
| β”‚  β”‚     β”‚  β”‚  β”‚     └─ optimistic readFile.....................130 ms (367)
| β”‚  β”‚     β”‚  β”‚  β”‚        └─ files.readFile                       128 ms (367)
| β”‚  β”‚     β”‚  β”‚  β”œβ”€ ImportScanner#scanImports for base64........1,257 ms (2)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”œβ”€ Npm.require("meteor-babel")                410 ms (1)
| β”‚  β”‚     β”‚  β”‚  β”‚  └─ other ImportScanner#scanImports for base64 829 ms
| β”‚  β”‚     β”‚  β”‚  β”œβ”€ ImportScanner#scanImports for minimongo.......256 ms (2)
| β”‚  β”‚     β”‚  β”‚  β”‚  └─ ImportScanner#findImportedModuleIdentifiers 213 ms (16)
| β”‚  β”‚     β”‚  β”‚  β”œβ”€ ImportScanner#scanImports for ddp-client      123 ms (2)
| β”‚  β”‚     β”‚  β”‚  β”œβ”€ ImportScanner#scanImports for the app......28,241 ms (2)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”œβ”€ ImportScanner#findImportedModuleIdentifiers 12,694 ms (2502)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”œβ”€ ImportScanner#resolve...................13,348 ms (11767)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  β”œβ”€ files.stat                           10,627 ms (65723)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  β”œβ”€ safeWatcher.watch.......................863 ms (50337)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  β”‚  β”œβ”€ files.watchFile                      401 ms (50337)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  β”‚  β”œβ”€ files.stat                           193 ms (960)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  β”‚  └─ other safeWatcher.watch              268 ms
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  β”œβ”€ optimistic readJsonOrNull...............230 ms (636)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  β”‚  └─ optimistic readFile..................200 ms (636)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  β”‚     └─ files.readFile                    191 ms (636)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  └─ other ImportScanner#resolve           1,540 ms
| β”‚  β”‚     β”‚  β”‚  β”‚  β”œβ”€ ImportScanner#realPath.....................175 ms (1430)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  └─ optimistic lstat........................123 ms (7214)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚     └─ files.lstat                          110 ms (7214)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”œβ”€ ImportScanner#readFile.....................932 ms (1430)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  β”œβ”€ optimistic readFile.....................614 ms (1430)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  β”‚  └─ files.readFile                       603 ms (1430)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  β”œβ”€ optimistic hashOrNull...................203 ms (1430)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  β”‚  └─ optimistic readFile..................128 ms (1430)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  β”‚     └─ files.readFile                    123 ms (1430)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  └─ other ImportScanner#readFile            115 ms
| β”‚  β”‚     β”‚  β”‚  β”‚  β”œβ”€ DefaultHandlers.js.........................740 ms (1428)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  └─ optimistic readFile.....................708 ms (1208)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚     └─ files.readFile                       690 ms (1208)
| β”‚  β”‚     β”‚  β”‚  β”‚  └─ other ImportScanner#scanImports for the app 331 ms
| β”‚  β”‚     β”‚  β”‚  β”œβ”€ optimistic hashOrNull.........................506 ms (3377)
| β”‚  β”‚     β”‚  β”‚  β”‚  └─ optimistic readFile........................428 ms (3377)
| β”‚  β”‚     β”‚  β”‚  β”‚     └─ files.readFile                          419 ms (3377)
| β”‚  β”‚     β”‚  β”‚  └─ other PackageSourceBatch.computeJsOutputFilesMap 217 ms
| β”‚  β”‚     β”‚  β”œβ”€ PackageSourceBatch#getResources..................851 ms (150)
| β”‚  β”‚     β”‚  β”‚  └─ PackageSourceBatch#_linkJS....................846 ms (150)
| β”‚  β”‚     β”‚  β”‚     β”œβ”€ optimistic readJsonOrNull..................624 ms (150)
| β”‚  β”‚     β”‚  β”‚     β”‚  β”œβ”€ optimistic readFile.....................214 ms (150)
| β”‚  β”‚     β”‚  β”‚     β”‚  β”‚  └─ files.readFile                       213 ms (150)
| β”‚  β”‚     β”‚  β”‚     β”‚  └─ other optimistic readJsonOrNull         410 ms
| β”‚  β”‚     β”‚  β”‚     └─ other PackageSourceBatch#_linkJS           209 ms
| β”‚  β”‚     β”‚  └─ other Target#_emitResources                      273 ms
| β”‚  β”‚     β”œβ”€ Target#minifyJs.................................110,839 ms (2)
| β”‚  β”‚     β”‚  β”œβ”€ processFilesForBundle........................110,264 ms (1448)
| β”‚  β”‚     β”‚  β”‚  β”œβ”€ minify file................................57,141 ms (1593)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”œβ”€ hash                                       458 ms (1593)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”œβ”€ readCache..................................215 ms (894)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”‚  └─ files.readFile                          195 ms (894)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”œβ”€ minifyOneFile                           55,685 ms (894)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”œβ”€ files.writeFile                            433 ms (894)
| β”‚  β”‚     β”‚  β”‚  β”‚  └─ other minify file                          351 ms
| β”‚  β”‚     β”‚  β”‚  β”œβ”€ extractModuleSizesTree......................6,717 ms (1597)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”œβ”€ Npm.require("meteor-babel")                298 ms (1)
| β”‚  β”‚     β”‚  β”‚  β”‚  └─ other extractModuleSizesTree             6,419 ms
| β”‚  β”‚     β”‚  β”‚  β”œβ”€ minify packages/modules.js.................37,808 ms (2)
| β”‚  β”‚     β”‚  β”‚  β”‚  β”œβ”€ hash                                       129 ms (2)
| β”‚  β”‚     β”‚  β”‚  β”‚  └─ minifyOneFile                           37,590 ms (2)
| β”‚  β”‚     β”‚  β”‚  β”œβ”€ minify app/app.js.............................757 ms (2)
| β”‚  β”‚     β”‚  β”‚  β”‚  └─ minifyOneFile                              733 ms (1)
| β”‚  β”‚     β”‚  β”‚  β”œβ”€ concat                                      6,695 ms (1448)
| β”‚  β”‚     β”‚  β”‚  β”œβ”€ addJavaScript                                 493 ms (1448)
| β”‚  β”‚     β”‚  β”‚  └─ other processFilesForBundle                   652 ms
| β”‚  β”‚     β”‚  └─ other Target#minifyJs                            507 ms
| β”‚  β”‚     └─ ClientTarget#minifyCss............................1,490 ms (2)
| β”‚  β”‚        └─ minifyCssFiles.................................1,490 ms (2)
| β”‚  β”‚           └─ CssTools.minifyCss                          1,475 ms (2)
| β”‚  β”œβ”€ bundler.bundle..makeServerTarget.......................12,731 ms (1)
| β”‚  β”‚  └─ Target#make.........................................12,730 ms (1)
| β”‚  β”‚     β”œβ”€ Target#_runCompilerPlugins.......................11,116 ms (1)
| β”‚  β”‚     β”‚  β”œβ”€ Isopack#ensurePluginsInitialized.................715 ms (184)
| β”‚  β”‚     β”‚  β”‚  └─ JsImage#load..................................713 ms (1)
| β”‚  β”‚     β”‚  β”‚     β”œβ”€ runJavaScript packages/ecmascript-runtime.js 288 ms (1)
| β”‚  β”‚     β”‚  β”‚     └─ runJavaScript packages/compileCoffeescript_plugin.js 188 ms (1)
| β”‚  β”‚     β”‚  └─ plugin aas395:angular-compilers               10,332 ms (3)
| β”‚  β”‚     └─ Target#_emitResources.............................1,594 ms (1)
| β”‚  β”‚        β”œβ”€ PackageSourceBatch.computeJsOutputFilesMap.....1,452 ms (1)
| β”‚  β”‚        β”‚  β”œβ”€ ImportScanner#scanImports for the app.........434 ms (1)
| β”‚  β”‚        β”‚  β”‚  β”œβ”€ ImportScanner#findImportedModuleIdentifiers 202 ms (86)
| β”‚  β”‚        β”‚  β”‚  └─ ImportScanner#resolve......................208 ms (517)
| β”‚  β”‚        β”‚  β”‚     └─ files.stat                              129 ms (874)
| β”‚  β”‚        β”‚  └─ optimistic hashOrNull.........................110 ms (324)
| β”‚  β”‚        β”‚     └─ optimistic readFile........................102 ms (324)
| β”‚  β”‚        β”‚        └─ files.readFile                          101 ms (324)
| β”‚  β”‚        └─ PackageSourceBatch#getResources..................113 ms (84)
| β”‚  β”‚           └─ PackageSourceBatch#_linkJS                    110 ms (84)
| β”‚  └─ bundler writeSiteArchive...............................50,358 ms (1)
| β”‚     β”œβ”€ bundler writeTargetToPath...........................50,095 ms (3)
| β”‚     β”‚  β”œβ”€ ClientTarget#write................................1,832 ms (2)
| β”‚     β”‚  β”‚  β”œβ”€ anti-XSSI header for source-maps                 120 ms (1448)
| β”‚     β”‚  β”‚  β”œβ”€ Builder#write....................................528 ms (1452)
| β”‚     β”‚  β”‚  β”‚  β”œβ”€ files.writeFile                               367 ms (1452)
| β”‚     β”‚  β”‚  β”‚  └─ other Builder#write                           110 ms
| β”‚     β”‚  β”‚  β”œβ”€ bundler writeFile................................657 ms (1454)
| β”‚     β”‚  β”‚  β”‚  β”œβ”€ Builder#write.................................506 ms (1454)
| β”‚     β”‚  β”‚  β”‚  β”‚  └─ files.writeFile                            387 ms (1454)
| β”‚     β”‚  β”‚  β”‚  └─ other bundler writeFile                       150 ms
| β”‚     β”‚  β”‚  └─ other ClientTarget#write                         404 ms
| β”‚     β”‚  └─ ServerTarget#write...............................48,257 ms (1)
| β”‚     β”‚     └─ JsImage#write.................................48,225 ms (1)
| β”‚     β”‚        β”œβ”€ files.stat                                    282 ms (2530)
| β”‚     β”‚        β”œβ”€ meteorNpm.isPortable..........................320 ms (28)
| β”‚     β”‚        β”‚  └─ meteorNpm.isPortable.......................293 ms (249)
| β”‚     β”‚        β”‚     └─ optimistic readJsonOrNull...............168 ms (247)
| β”‚     β”‚        β”‚        └─ optimistic readFile..................162 ms (247)
| β”‚     β”‚        β”‚           └─ files.readFile                    161 ms (247)
| β”‚     β”‚        β”œβ”€ Builder#copyNodeModulesDirectory...........47,177 ms (28)
| β”‚     β”‚        β”‚  β”œβ”€ Builder#_ensureDirectory.................2,025 ms (3846)
| β”‚     β”‚        β”‚  β”‚  β”œβ”€ files.stat                            1,155 ms (11625)
| β”‚     β”‚        β”‚  β”‚  β”œβ”€ files.mkdir                             519 ms (3875)
| β”‚     β”‚        β”‚  β”‚  └─ other Builder#_ensureDirectory          351 ms
| β”‚     β”‚        β”‚  β”œβ”€ optimistic readdir.........................452 ms (3846)
| β”‚     β”‚        β”‚  β”‚  └─ files.readdir                           439 ms (3846)
| β”‚     β”‚        β”‚  β”œβ”€ optimistic lstat.........................3,497 ms (49389)
| β”‚     β”‚        β”‚  β”‚  β”œβ”€ files.lstat                           3,317 ms (49389)
| β”‚     β”‚        β”‚  β”‚  └─ other optimistic lstat                  180 ms
| β”‚     β”‚        β”‚  β”œβ”€ files.stat                                 821 ms (44999)
| β”‚     β”‚        β”‚  β”œβ”€ optimistic hashOrNull...................19,134 ms (44999)
| β”‚     β”‚        β”‚  β”‚  β”œβ”€ optimistic readFile..................17,237 ms (44999)
| β”‚     β”‚        β”‚  β”‚  β”‚  β”œβ”€ files.readFile                    17,015 ms (44999)
| β”‚     β”‚        β”‚  β”‚  β”‚  └─ other optimistic readFile            222 ms
| β”‚     β”‚        β”‚  β”‚  β”œβ”€ sha1                                  1,495 ms (44999)
| β”‚     β”‚        β”‚  β”‚  └─ other optimistic hashOrNull             402 ms
| β”‚     β”‚        β”‚  β”œβ”€ optimistic readFile......................4,260 ms (44999)
| β”‚     β”‚        β”‚  β”‚  β”œβ”€ files.readFile                        4,122 ms (44999)
| β”‚     β”‚        β”‚  β”‚  └─ other optimistic readFile               138 ms
| β”‚     β”‚        β”‚  β”œβ”€ files.writeFile                         13,297 ms (44999)
| β”‚     β”‚        β”‚  └─ other Builder#copyNodeModulesDirectory   3,635 ms
| β”‚     β”‚        β”œβ”€ optimistic readJsonOrNull.....................189 ms (398)
| β”‚     β”‚        β”‚  └─ optimistic readFile........................156 ms (398)
| β”‚     β”‚        β”‚     └─ files.readFile                          154 ms (398)
| β”‚     β”‚        └─ other JsImage#write                           134 ms
| β”‚     └─ other bundler writeSiteArchive                         253 ms
| └─ other meteor build                                           126 ms
| 
| Top leaves:
| plugin aas395:angular-compilers.........................38,699 ms (9)
| minifyOneFile...........................................38,323 ms (3)
| files.readFile..........................................32,284 ms (155472)
| files.stat..............................................17,733 ms (401823)
| files.writeFile.........................................14,580 ms (48959)
| concat...................................................6,695 ms (1448)
| other extractModuleSizesTree.............................6,419 ms (1597)
| files.lstat..............................................3,798 ms (76164)
| other Builder#copyNodeModulesDirectory...................3,635 ms (28)
| sha1.....................................................2,309 ms (83450)
| other PackageSource#_findSources.........................1,717 ms (3)
| other ImportScanner#resolve..............................1,664 ms (13508)
| CssTools.minifyCss.......................................1,475 ms (2)
| other compileUnibuild (the app)..........................1,406 ms (3)
| files.readdir............................................1,141 ms (24196)
| files.read...............................................1,074 ms (3294)
| other ImportScanner#scanImports for base64.................829 ms (2)
| other processFilesForBundle................................652 ms (1448)
| other optimistic readJsonOrNull............................637 ms (5607)
| files.watchFile............................................608 ms (57269)
| hash.......................................................601 ms (1597)
| files.mkdir................................................569 ms (4332)
| other optimistic readFile..................................559 ms (151733)
| other optimistic hashOrNull................................553 ms (74126)
| other Target#minifyJs......................................507 ms (2)
| addJavaScript..............................................493 ms (1448)
| files.realpath.............................................419 ms (10383)
| other ClientTarget#write...................................404 ms (2)
| files.open.................................................400 ms (3294)
| other ImportScanner#scanImports for the app................354 ms (3)
| other Builder#_ensureDirectory.............................351 ms (3846)
| other minify file..........................................351 ms (1593)
| other safeWatcher.watch....................................325 ms (52745)
| other Target#_emitResources................................302 ms (3)
| Babel.compile..............................................280 ms (202)
| other PackageSourceBatch.computeJsOutputFilesMap...........267 ms (3)
| other bundler writeSiteArchive.............................253 ms (1)
| other optimistic lstat.....................................214 ms (70929)
| other PackageSourceBatch#_linkJS...........................209 ms (150)
| other Builder#write........................................208 ms (2906)
| require("./security.js")...................................201 ms (4)
| sha512.....................................................158 ms (3052)
| other Isopack#initFromPath.................................151 ms (8)
| other bundler writeFile....................................150 ms (1454)
| other ImportScanner#realPath...............................149 ms (4346)
| other JsImage#write........................................134 ms (1)
| other meteor build.........................................126 ms (1)
| other ImportScanner#readFile...............................122 ms (1797)
| anti-XSSI header for source-maps...........................120 ms (1448)
| ImportScanner#getAbsModuleId...............................109 ms (7399)
| 
| (#1) Total: 267,098 ms (meteor build)
| 

Let me know if you see anything that looks like it could be sped up here. Thank you again!

We also see long build times on Meteor compared to other platforms. Would love more love put into dev experience around build.

1 Like

The length of the production build time ended up being more about AWS’s CodeBuild service than it did about our normal local build times. It takes around twice as long on one of their instances to build as it does on my local computer.

In an attempt to speed this up, I upgraded to the next tier of instance, which sounded faster, but the build time ended up being the same as in the original tier. The higher tier instance has more cores and more memory but it seems that Meteor’s build process can’t take advantage of additional cores. I put in a feature request in the Meteor feature request repo but it would be great if there were a way for Meteor to use the additional cores available on any given machine to speed up the build process.