{"push_id":1048477520,"size":1,"distinct_size":1,"ref":"refs/heads/master","head":"9a6d54f416cef347711c3b67046effda17987522","before":"6fc00d98319ca5fa27b88b801578f76d42948a97","commits":[{"sha":"9a6d54f416cef347711c3b67046effda17987522","author":{"email":"fda5fd98179815a22ae358022eadeb52f103eac9@fb.com","name":"Andres Suarez"},"message":"Lazy require babel-core, temp and move in node-transpiler\n\nSummary:This module will not be covered by the upcoming inline-imports, so I'm manually deferring requires.\n\nThis covers two cases:\n\n* In production builds, since everything except the service implementations are pre-transpiled, nothing has the `'use babel'` pragma. So `babel-cache.js` will never need to load.\n* In development, we'll load `babel-cache.js` because files still have the `'use babel'` pragma. However, since everything is likely to be in the `babel-cache`, there is no need to require babel and friends.\n\nThis change affects the debugger and path-search (via nuclide-task). I only benchmarked path-search:\n\n**Before:**\n\n```\nTASK(31822): initFileSearchForDirectory\norder  ms         %    depth:filename\n16     18.98ms    1%   21:/node_modules/lodash/object/keys.js\n17     19.76ms    1%   20:/node_modules/lodash/internal/assignWith.js\n25     26.03ms    1%   19:/node_modules/lodash/object/assign.js\n29     10.85ms    0%   23:/node_modules/lodash/internal/baseFor.js\n30     11.82ms    0%   22:/node_modules/lodash/internal/baseForOwn.js\n32     13.86ms    0%   21:/node_modules/lodash/internal/baseEach.js\n34     19.43ms    1%   20:/node_modules/lodash/collection/forEach.js\n35     23.78ms    1%   19:/node_modules/lodash/collection/each.js\n40     11.17ms    0%   25:/node_modules/lodash/lang/isTypedArray.js\n41     14.93ms    0%   24:/node_modules/lodash/internal/baseIsEqualDeep.js\n42     16.24ms    0%   23:/node_modules/lodash/internal/baseIsEqual.js\n43     17.1ms     0%   22:/node_modules/lodash/internal/baseIsMatch.js\n47     20.83ms    1%   21:/node_modules/lodash/internal/baseMatches.js\n57     31ms       1%   20:/node_modules/lodash/internal/baseCallback.js\n66     38.78ms    2%   19:/node_modules/lodash/array/uniq.js\n68     18.34ms    1%   20:/node_modules/babel-core/lib/types/definitions/core.js\n74     26.93ms    1%   19:/node_modules/babel-core/lib/types/definitions/init.js\n86     10.92ms    0%   19:/node_modules/babel-core/lib/types/converters.js\n88     152.91ms   8%   18:/node_modules/babel-core/lib/types/index.js\n89     154.26ms   9%   17:/node_modules/babel-core/lib/transformation/helpers/react.js\n90     160.92ms   9%   16:?e_modules/babel-core/lib/traversal/path/lib/virtual-types.js\n93     12.1ms     0%   17:/node_modules/lodash/collection/includes.js\n109    34.12ms    1%   16:/node_modules/babel-core/lib/traversal/scope/index.js\n119    15.67ms    0%   20:/node_modules/color-convert/index.js\n123    14.26ms    0%   19:/node_modules/supports-color/index.js\n124    56.62ms    3%   18:/node_modules/chalk/index.js\n125    67.96ms    3%   17:/node_modules/babel-core/lib/helpers/code-frame.js\n133    37.4ms     2%   20:/node_modules/babylon/lib/tokenizer/index.js\n134    41.29ms    2%   19:/node_modules/babylon/lib/parser/index.js\n145    69.82ms    4%   18:/node_modules/babylon/lib/index.js\n146    70.6ms     4%   17:/node_modules/babel-core/lib/helpers/parse.js\n147    141.43ms   8%   16:/node_modules/babel-core/lib/traversal/path/replacement.js\n158    369.53ms   21%  15:/node_modules/babel-core/lib/traversal/path/index.js\n159    371.99ms   21%  14:/node_modules/babel-core/lib/traversal/context.js\n168    383.88ms   22%  13:/node_modules/babel-core/lib/traversal/index.js\n169    384.74ms   22%  12:/node_modules/babel-core/lib/transformation/plugin-pass.js\n180    17.18ms    1%   19:/node_modules/brace-expansion/index.js\n181    20.5ms     1%   18:/node_modules/babel-core/node_modules/minimatch/minimatch.js\n185    12.53ms    0%   18:/node_modules/slash/index.js\n188    59.1ms     3%   17:/node_modules/babel-core/lib/util.js\n189    65.32ms    3%   16:?de_modules/babel-core/lib/transformation/modules/_default.js\n190    76.05ms    4%   15:?node_modules/babel-core/lib/transformation/modules/common.js\n192    77.87ms    4%   14:?dules/babel-core/lib/transformation/modules/common-strict.js\n200    10.14ms    0%   14:?node_modules/babel-core/lib/transformation/modules/system.js\n202    97.99ms    5%   13:/node_modules/babel-core/lib/transformation/modules/index.js\n213    17.96ms    1%   13:?babel-core/lib/transformation/file/options/option-manager.js\n225    19.33ms    1%   13:/node_modules/source-map/source-map.js\n237    14.01ms    0%   14:/node_modules/babel-core/lib/generation/node/index.js\n250    59.05ms    3%   13:/node_modules/babel-core/lib/generation/index.js\n254    25.71ms    1%   14:/node_modules/debug/node.js\n255    27.39ms    1%   13:/node_modules/babel-core/lib/transformation/file/logger.js\n257    246.41ms   14%  12:/node_modules/babel-core/lib/transformation/file/index.js\n258    633.64ms   36%  11:/node_modules/babel-core/lib/transformation/plugin.js\n259    634.53ms   37%  10:/node_modules/babel-core/lib/transformation/transformer.js\n260    636.94ms   37%  9:?modules/babel-core/lib/transformation/file/plugin-manager.js\n262    651.35ms   38%  8:/node_modules/babel-core/lib/transformation/pipeline.js\n263    26.25ms    1%   9:/node_modules/babel-plugin-constant-folding/lib/index.js\n267    30.47ms    1%   9:?lib/transformation/transformers/internal/hoist-directives.js\n268    13.94ms    0%   9:/node_modules/babel-plugin-remove-debugger/lib/index.js\n293    10.49ms    0%   9:?de_modules/babel-plugin-react-constant-elements/lib/index.js\n296    22ms       1%   9:?l-core/lib/transformation/transformers/es7/comprehensions.js\n303    11.11ms    0%   9:?/lib/transformation/transformers/other/async-to-generator.js\n322    38.8ms     2%   10:/node_modules/regexpu/rewrite-pattern.js\n323    39.78ms    2%   9:?el-core/lib/transformation/transformers/es6/regex.unicode.js\n333    11.16ms    0%   10:?re/lib/transformation/transformers/es6/parameters/default.js\n335    15.26ms    0%   9:?core/lib/transformation/transformers/es6/parameters/index.js\n344    14.31ms    0%   16:/node_modules/ast-types/lib/shared.js\n345    36.71ms    2%   15:/node_modules/ast-types/def/core.js\n348    18.55ms    1%   15:/node_modules/ast-types/def/mozilla.js\n350    15.29ms    0%   15:/node_modules/ast-types/def/fb-harmony.js\n358    131.88ms   7%   14:/node_modules/ast-types/main.js\n359    132.44ms   7%   13:/node_modules/recast/lib/types.js\n360    51.35ms    2%   17:/node_modules/esprima-fb/esprima.js\n361    52.5ms     3%   16:/node_modules/recast/lib/options.js\n365    66.24ms    3%   15:/node_modules/recast/lib/lines.js\n367    73.87ms    4%   14:/node_modules/recast/lib/patcher.js\n369    76.64ms    4%   13:/node_modules/recast/lib/parser.js\n371    214.23ms   12%  12:/node_modules/recast/main.js\n377    233.58ms   13%  11:/node_modules/regenerator/lib/visit.js\n378    236.81ms   13%  10:/node_modules/regenerator/main.js\n379    237.97ms   13%  9:?el-core/lib/transformation/transformers/other/regenerator.js\n391    12ms       0%   9:?/babel-core/lib/transformation/transformers/es6/tail-call.js\n401    19.03ms    1%   9:?core/lib/transformation/transformers/internal/block-hoist.js\n405    593.95ms   34%  8:?_modules/babel-core/lib/transformation/transformers/index.js\n408    35.88ms    2%   8:?odules/babel-core/lib/transformation/transformers/filters.js\n409    1316.15ms  76%  7:/node_modules/babel-core/lib/transformation/index.js\n410    21.96ms    1%   7:/node_modules/babel-core/lib/tools/build-external-helpers.js\n412    1345.97ms  78%  6:/node_modules/babel-core/lib/api/node.js\n413    1348.89ms  78%  5:/node_modules/babel-core/index.js\n414    11.2ms     0%   6:/node_modules/temp/node_modules/rimraf/rimraf.js\n416    14.62ms    0%   5:/node_modules/temp/lib/temp.js\n425    23.89ms    1%   7:/node_modules/glob/glob.js\n426    25.5ms     1%   6:/node_modules/mv/node_modules/rimraf/rimraf.js\n428    29.78ms    1%   5:/node_modules/mv/index.js\n429    1404.5ms   81%  4:/pkg/nuclide-node-transpiler/lib/babel-cache.js\n430    1405.89ms  82%  3:/pkg/nuclide-node-transpiler/lib/transpile.js\n431    1407.05ms  82%  2:/pkg/nuclide-node-transpiler/lib/main.js\n433    15.84ms    0%   3:/pkg/nuclide-remote-uri/lib/main.js\n436    15.56ms    0%   3:/pkg/nuclide-logging/lib/main.js\n439    10.51ms    0%   4:/pkg/nuclide-commons/lib/clientInfo.js\n440    10.14ms    0%   7:/node_modules/underscore/underscore.js\n441    13.46ms    0%   6:/node_modules/underscore-plus/lib/underscore-plus.js\n445    24.13ms    1%   5:/node_modules/fs-plus/lib/fs-plus.js\n449    66.26ms    3%   8:/node_modules/rx/dist/rx.js\n455    10.25ms    0%   8:/node_modules/rx/dist/rx.js\n460    31.48ms    1%   8:/node_modules/rx/dist/rx.js\n461    142.24ms   8%   7:/node_modules/rx/index.js\n462    143.19ms   8%   6:/pkg/nuclide-commons/lib/stream.js\n467    152.97ms   8%   5:/pkg/nuclide-commons/lib/process.js\n469    184.69ms   10%  4:/pkg/nuclide-commons/lib/filesystem.js\n473    201.22ms   11%  4:/pkg/nuclide-logging/lib/config.js\n474    15.69ms    0%   8:/node_modules/semver/semver.js\n476    18.35ms    1%   7:/node_modules/pre-binding/lib/util/versioning.js\n477    19.45ms    1%   6:/node_modules/pre-binding/lib/pre-binding.js\n479    29.06ms    1%   5:/pkg/nuclide-fuzzy-native/VendorLib/fuzzy-native/lib/main.js\n480    250.2ms    14%  4:/pkg/nuclide-fuzzy-native/lib/main.js\n481    251.56ms   14%  3:/pkg/nuclide-path-search/lib/PathSet.js\n486    300.21ms   17%  2:/pkg/nuclide-path-search/lib/FileSearch.js\n\nTotal time: 1714ms\n```\n\nAfter:\n\n```\nTASK(31574): initFileSearchForDirectory\norder  ms        %    depth:filename\n1      13.16ms   5%   4:/pkg/nuclide-node-transpiler/lib/babel-cache.js\n2      14.72ms   6%   3:/pkg/nuclide-node-transpiler/lib/transpile.js\n3      15.95ms   6%   2:/pkg/nuclide-node-transpiler/lib/main.js\n13     13.15ms   5%   6:/node_modules/underscore-plus/lib/underscore-plus.js\n17     27.52ms   11%  5:/node_modules/fs-plus/lib/fs-plus.js\n20     10.25ms   4%   6:/pkg/nuclide-commons/lib/PromiseExecutors.js\n21     21.96ms   9%   8:/node_modules/rx/dist/rx.js\n33     58.67ms   24%  7:/node_modules/rx/index.js\n34     59.95ms   24%  6:/pkg/nuclide-commons/lib/stream.js\n39     77.27ms   31%  5:/pkg/nuclide-commons/lib/process.js\n44     14.11ms   5%   7:/node_modules/minimatch/minimatch.js\n52     25.56ms   10%  6:/node_modules/glob/glob.js\n53     27.72ms   11%  5:/node_modules/rimraf/rimraf.js\n54     137.79ms  56%  4:/pkg/nuclide-commons/lib/filesystem.js\n58     149.84ms  61%  4:/pkg/nuclide-logging/lib/config.js\n62     11.2ms    4%   6:/node_modules/pre-binding/lib/pre-binding.js\n64     22.17ms   9%   5:/pkg/nuclide-fuzzy-native/VendorLib/fuzzy-native/lib/main.js\n65     183.42ms  75%  4:/pkg/nuclide-fuzzy-native/lib/main.js\n66     185.17ms  76%  3:/pkg/nuclide-path-search/lib/PathSet.js\n72     215.62ms  88%  2:/pkg/nuclide-path-search/lib/FileSearch.js\n\nTotal time: 243ms\n```\n\nThat's a decrease from 1714ms to 243ms. The wins should be similar for the debugger.\n\nReviewed By: jgebhardt\n\nDifferential Revision: D3130392\n\nfb-gh-sync-id: 81bfcc409a8b7e5896c64203204e5faacfc57d4a\nfbshipit-source-id: 81bfcc409a8b7e5896c64203204e5faacfc57d4a","distinct":true,"url":"https://api.github.com/repos/PKRoma/nuclide/commits/9a6d54f416cef347711c3b67046effda17987522"}]}