|
2 | 2 | /// <reference path="emitter.ts" /> |
3 | 3 |
|
4 | 4 | module ts { |
| 5 | + /* @internal */ export let programTime = 0; |
5 | 6 | /* @internal */ export let emitTime = 0; |
6 | 7 | /* @internal */ export let ioReadTime = 0; |
| 8 | + /* @internal */ export let ioWriteTime = 0; |
7 | 9 |
|
8 | 10 | /** The version of the TypeScript compiler release */ |
9 | 11 | export let version = "1.5.0.0"; |
@@ -36,33 +38,34 @@ module ts { |
36 | 38 | } |
37 | 39 | text = ""; |
38 | 40 | } |
39 | | - |
40 | 41 | return text !== undefined ? createSourceFile(fileName, text, languageVersion) : undefined; |
41 | 42 | } |
42 | 43 |
|
43 | | - function writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) { |
44 | | - function directoryExists(directoryPath: string): boolean { |
45 | | - if (hasProperty(existingDirectories, directoryPath)) { |
46 | | - return true; |
47 | | - } |
48 | | - if (sys.directoryExists(directoryPath)) { |
49 | | - existingDirectories[directoryPath] = true; |
50 | | - return true; |
51 | | - } |
52 | | - return false; |
| 44 | + function directoryExists(directoryPath: string): boolean { |
| 45 | + if (hasProperty(existingDirectories, directoryPath)) { |
| 46 | + return true; |
53 | 47 | } |
| 48 | + if (sys.directoryExists(directoryPath)) { |
| 49 | + existingDirectories[directoryPath] = true; |
| 50 | + return true; |
| 51 | + } |
| 52 | + return false; |
| 53 | + } |
54 | 54 |
|
55 | | - function ensureDirectoriesExist(directoryPath: string) { |
56 | | - if (directoryPath.length > getRootLength(directoryPath) && !directoryExists(directoryPath)) { |
57 | | - let parentDirectory = getDirectoryPath(directoryPath); |
58 | | - ensureDirectoriesExist(parentDirectory); |
59 | | - sys.createDirectory(directoryPath); |
60 | | - } |
| 55 | + function ensureDirectoriesExist(directoryPath: string) { |
| 56 | + if (directoryPath.length > getRootLength(directoryPath) && !directoryExists(directoryPath)) { |
| 57 | + let parentDirectory = getDirectoryPath(directoryPath); |
| 58 | + ensureDirectoriesExist(parentDirectory); |
| 59 | + sys.createDirectory(directoryPath); |
61 | 60 | } |
| 61 | + } |
62 | 62 |
|
| 63 | + function writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) { |
63 | 64 | try { |
| 65 | + var start = new Date().getTime(); |
64 | 66 | ensureDirectoriesExist(getDirectoryPath(normalizePath(fileName))); |
65 | 67 | sys.writeFile(fileName, data, writeByteOrderMark); |
| 68 | + ioWriteTime += new Date().getTime() - start; |
66 | 69 | } |
67 | 70 | catch (e) { |
68 | 71 | if (onError) { |
@@ -120,16 +123,19 @@ module ts { |
120 | 123 | let diagnostics = createDiagnosticCollection(); |
121 | 124 | let seenNoDefaultLib = options.noLib; |
122 | 125 | let commonSourceDirectory: string; |
123 | | - host = host || createCompilerHost(options); |
| 126 | + let diagnosticsProducingTypeChecker: TypeChecker; |
| 127 | + let noDiagnosticsTypeChecker: TypeChecker; |
124 | 128 |
|
| 129 | + let start = new Date().getTime(); |
| 130 | + |
| 131 | + host = host || createCompilerHost(options); |
125 | 132 | forEach(rootNames, name => processRootFile(name, false)); |
126 | 133 | if (!seenNoDefaultLib) { |
127 | 134 | processRootFile(host.getDefaultLibFileName(options), true); |
128 | 135 | } |
129 | 136 | verifyCompilerOptions(); |
130 | 137 |
|
131 | | - let diagnosticsProducingTypeChecker: TypeChecker; |
132 | | - let noDiagnosticsTypeChecker: TypeChecker; |
| 138 | + programTime += new Date().getTime() - start; |
133 | 139 |
|
134 | 140 | program = { |
135 | 141 | getSourceFile: getSourceFile, |
|
0 commit comments