Skip to content

Compile times inconsistent with module dependents count? #8479

Description

@myitcv
$ tsc --version
Version 1.9.0-dev.20160505
$ node --version
v5.10.1   # in case it's relevant to this discussion
{
  "compilerOptions": {
    "declaration": false,
    "jsx": "react",
    "module": "system",
    "newLine": "LF",
    "noEmitOnError": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noLib": true,
    "removeComments": false,
    "rootDir": ".",
    "sourceMap": true,
    "target": "es5"
  }
}

We have a relatively modest ~210k lines of code/type definitions etc in our application.

Some of our core files are import-ed by many files (e.g. a core utility library). i.e. there are many dependents on such modules. Let's call this Group 1.

Other files, e.g. tests, are never import-ed by any other files. i.e. there are zero dependents on such modules. Let's call this Group 2.

We use tsc --watch to recompile when any of the files as referenced by tsconfig.json are modified.

The bizarre thing is that compile times are relatively constant, regardless of whether a file modification happens to a file from Group 1 or Group 2. In the following relatively unscientific tests, I simply touch-ed a file from the named group, i.e. bumped it's modification time, and observed the time stamps output from tsc --watch:

# e.g.
6:59:04 PM - File change detected. Starting incremental compilation...
6:59:12 PM - Compilation complete. Watching for file changes.
  1. Group 1: > 100 dependents: ~7-11 secs
  2. Group 2: 0 dependents: ~7-11 secs

Let's ignore the fact for a second there is a wide range of compile times

This doesn't seem to make much sense (but then I know very little about the compiler!) because Group 2 files have zero dependents.

Gut instinct would tell me that the re-compile times when changes are limited to a single Group 2 file should be an order of magnitude lower.

Can someone either correct this false expectation or chime in here?

Clearly we, like others, would love to see compile times fall as much as possible because it makes the development lifecycle that much more pleasant so I'd be more than willing to help debug/provide analysis on the above observation.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions