Skip to content

Slow performance due to certain tsconfig opts #1060

@brunohcastro

Description

@brunohcastro

My project uses the awesome angularclass angular2 webpack starter for the front end.

I started noticing the pending requests stacking up. The autocomplete suggestion take too long to show. It annoyed me so much that I migrated to sublime text.

But I really like Atom interface and how easy it is to customize it (and the open source part too). So I decided to check why the performance was so poor. I know this is a great plugin and it didn't make any sense.

This is part of the actual tsconfig.json from AngularClass/angular2-webpack-starter

  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "noEmitHelpers": true,
    "strictNullChecks": false,
    "baseUrl": "./src",
    "paths": [
    ],
    "lib": [
      "dom",
      "es6"
    ],
    "types": [
      "core-js",
      "hammerjs",
      "jasmine",
      "node",
      "protractor",
      "selenium-webdriver",
      "source-map",
      "uglify-js",
      "webpack"
    ]
  }

So here is what I found out:

  1. The tsconfig from angularclass starter project uses typescript 2 and take advantage from the @types packages to get missing definitions. To reference this typings, they use the "types" opt inside "compilerOptions" key. Removing it GREATLY improved the performance.
  2. The "lib" opt also seems to have some impact in the performance, specially if you include the "dom" lib.

To add the types right and still use the @types packages, I just added one more line to the filesGlob:

    "filesGlob": [
        "!node_modules",
        "node_modules/@types/**/*.d.ts",
        "src/**/*.d.ts",
        "src/**/*.ts"
    ]

It is even easier now to add new types. They are automatically detected now!

So, I just opened this issue to report my findings and to help anyone that is having the same issue.
I hope that this report helps to solve this performances problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions