Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typescript --allowJs too slow #7808

Closed
viktor-nikolaev opened this issue Apr 4, 2016 · 3 comments
Closed

typescript --allowJs too slow #7808

viktor-nikolaev opened this issue Apr 4, 2016 · 3 comments
Labels
Needs More Info The issue still hasn't been fully clarified

Comments

@viktor-nikolaev
Copy link

TypeScript Version:

1.8.9

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "amd",
    "noEmitOnError": true,
    "allowJs": true
  },
  "exclude": [
    "node_modules",
    "bower_components"
  ]
}

gulp task

var  ts = require("gulp-typescript"),

var tsProject = ts.createProject("tsconfig.json", {
    noExternalResolve: true,
    typescript: require("typescript")
});

gulp.task("scripts", function() {
    return gulp.src(paths.devroot.ts)
        .pipe(ts(tsProject))
        .pipe(gulp.dest(paths.webroot.app));
});

gulp.task("watch", ["scripts"], function() {
    gulp.watch(paths.devroot.ts, ["scripts"]);
})

When I run the task with --allowJs set to true, it takes about 10seconds to build my project. Moreover it takes 10 seconds after any change in my files, ie it is not incrementaly.

When --allowJs is disabled, it takes about 1 second to build the whole project, and 100ms to build incrementally.

@mhegazy
Copy link
Contributor

mhegazy commented Apr 4, 2016

can you run tsc --diagnistics --listFiles with and without --allowJs and share the output?

@mhegazy mhegazy added the Needs More Info The issue still hasn't been fully clarified label Apr 4, 2016
@viktor-nikolaev
Copy link
Author

@mhegazy , i ran it in a working pc, that a bit faster.
Actually, the main problem is with "-watch".

diag.allowJs.txt
diag.disallowJs.txt

diag.allowJs.watch.txt
diag.disallowJs.watch.txt

@mhegazy
Copy link
Contributor

mhegazy commented Apr 5, 2016

in the allowJS case, you are pulling in many more files (244 vs. 50). we are spending 2 more seconds in additional IO (reading the extra files, and writing their output) and 2 more seconds in type checking them see below.

without --allowJs

Files:             244
Lines:           54431
Nodes:          260098
Identifiers:     88870
Symbols:       7629718
Types:           11834
Memory used:   143379K
I/O read:        0.06s
I/O write:       1.99s
Parse time:      0.86s
Bind time:       0.40s
Check time:      2.17s
Emit time:       2.63s
Total time:      6.07s

No --allowJs

Files:              50
Lines:           24110
Nodes:           97627
Identifiers:     37579
Symbols:       1158822
Types:            6640
Memory used:    69853K
I/O read:        0.01s
I/O write:       0.07s
Parse time:      0.32s
Bind time:       0.26s
Check time:      0.78s
Emit time:       0.21s
Total time:      1.57s

The question is do you intend to include these files in your compilation? if no, then you should add App_Scripts to your exclude in tsconfig.json.

@mhegazy mhegazy closed this as completed May 20, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

2 participants