@@ -404,6 +404,7 @@ namespace ts {
404
404
return isParsedCommandLine ( value ) ? value : undefined ;
405
405
}
406
406
407
+ performance . mark ( "SolutionBuilder::beforeConfigFileParsing" ) ;
407
408
let diagnostic : Diagnostic | undefined ;
408
409
const { parseConfigFileHost, baseCompilerOptions, baseWatchOptions, extendedConfigCache, host } = state ;
409
410
let parsed : ParsedCommandLine | undefined ;
@@ -417,6 +418,8 @@ namespace ts {
417
418
parseConfigFileHost . onUnRecoverableConfigFileDiagnostic = noop ;
418
419
}
419
420
configFileCache . set ( configFilePath , parsed || diagnostic ! ) ;
421
+ performance . mark ( "SolutionBuilder::afterConfigFileParsing" ) ;
422
+ performance . measure ( "SolutionBuilder::Config file parsing" , "SolutionBuilder::beforeConfigFileParsing" , "SolutionBuilder::afterConfigFileParsing" ) ;
420
423
return parsed ;
421
424
}
422
425
@@ -734,6 +737,7 @@ namespace ts {
734
737
if ( updateOutputFileStampsPending ) {
735
738
updateOutputTimestamps ( state , config , projectPath ) ;
736
739
}
740
+ performance . mark ( "SolutionBuilder::Timestamps only updates" ) ;
737
741
return doneInvalidatedProject ( state , projectPath ) ;
738
742
}
739
743
} ;
@@ -847,6 +851,8 @@ namespace ts {
847
851
848
852
function done ( cancellationToken ?: CancellationToken , writeFile ?: WriteFileCallback , customTransformers ?: CustomTransformers ) {
849
853
executeSteps ( BuildStep . Done , cancellationToken , writeFile , customTransformers ) ;
854
+ if ( kind === InvalidatedProjectKind . Build ) performance . mark ( "SolutionBuilder::Projects built" ) ;
855
+ else performance . mark ( "SolutionBuilder::Bundles updated" ) ;
850
856
return doneInvalidatedProject ( state , projectPath ) ;
851
857
}
852
858
@@ -1809,7 +1815,10 @@ namespace ts {
1809
1815
return prior ;
1810
1816
}
1811
1817
1818
+ performance . mark ( "SolutionBuilder::beforeUpToDateCheck" ) ;
1812
1819
const actual = getUpToDateStatusWorker ( state , project , resolvedPath ) ;
1820
+ performance . mark ( "SolutionBuilder::afterUpToDateCheck" ) ;
1821
+ performance . measure ( "SolutionBuilder::Up-to-date check" , "SolutionBuilder::beforeUpToDateCheck" , "SolutionBuilder::afterUpToDateCheck" ) ;
1813
1822
state . projectStatus . set ( resolvedPath , actual ) ;
1814
1823
return actual ;
1815
1824
}
@@ -1958,6 +1967,14 @@ namespace ts {
1958
1967
}
1959
1968
1960
1969
function build ( state : SolutionBuilderState , project ?: string , cancellationToken ?: CancellationToken , writeFile ?: WriteFileCallback , getCustomTransformers ?: ( project : string ) => CustomTransformers , onlyReferences ?: boolean ) : ExitStatus {
1970
+ performance . mark ( "SolutionBuilder::beforeBuild" ) ;
1971
+ const result = buildWorker ( state , project , cancellationToken , writeFile , getCustomTransformers , onlyReferences ) ;
1972
+ performance . mark ( "SolutionBuilder::afterBuild" ) ;
1973
+ performance . measure ( "SolutionBuilder::Build" , "SolutionBuilder::beforeBuild" , "SolutionBuilder::afterBuild" ) ;
1974
+ return result ;
1975
+ }
1976
+
1977
+ function buildWorker ( state : SolutionBuilderState , project : string | undefined , cancellationToken : CancellationToken | undefined , writeFile : WriteFileCallback | undefined , getCustomTransformers : ( ( project : string ) => CustomTransformers ) | undefined , onlyReferences : boolean | undefined ) : ExitStatus {
1961
1978
const buildOrder = getBuildOrderFor ( state , project , onlyReferences ) ;
1962
1979
if ( ! buildOrder ) return ExitStatus . InvalidProject_OutputsSkipped ;
1963
1980
@@ -1986,7 +2003,15 @@ namespace ts {
1986
2003
: ExitStatus . DiagnosticsPresent_OutputsSkipped ;
1987
2004
}
1988
2005
1989
- function clean ( state : SolutionBuilderState , project ?: string , onlyReferences ?: boolean ) {
2006
+ function clean ( state : SolutionBuilderState , project ?: string , onlyReferences ?: boolean ) : ExitStatus {
2007
+ performance . mark ( "SolutionBuilder::beforeClean" ) ;
2008
+ const result = cleanWorker ( state , project , onlyReferences ) ;
2009
+ performance . mark ( "SolutionBuilder::afterClean" ) ;
2010
+ performance . measure ( "SolutionBuilder::Clean" , "SolutionBuilder::beforeClean" , "SolutionBuilder::afterClean" ) ;
2011
+ return result ;
2012
+ }
2013
+
2014
+ function cleanWorker ( state : SolutionBuilderState , project : string | undefined , onlyReferences : boolean | undefined ) {
1990
2015
const buildOrder = getBuildOrderFor ( state , project , onlyReferences ) ;
1991
2016
if ( ! buildOrder ) return ExitStatus . InvalidProject_OutputsSkipped ;
1992
2017
@@ -2063,6 +2088,14 @@ namespace ts {
2063
2088
}
2064
2089
2065
2090
function buildNextInvalidatedProject ( state : SolutionBuilderState , changeDetected : boolean ) {
2091
+ performance . mark ( "SolutionBuilder::beforeBuild" ) ;
2092
+ const buildOrder = buildNextInvalidatedProjectWorker ( state , changeDetected ) ;
2093
+ performance . mark ( "SolutionBuilder::afterBuild" ) ;
2094
+ performance . measure ( "SolutionBuilder::Build" , "SolutionBuilder::beforeBuild" , "SolutionBuilder::afterBuild" ) ;
2095
+ if ( buildOrder ) reportErrorSummary ( state , buildOrder ) ;
2096
+ }
2097
+
2098
+ function buildNextInvalidatedProjectWorker ( state : SolutionBuilderState , changeDetected : boolean ) {
2066
2099
state . timerToBuildInvalidatedProject = undefined ;
2067
2100
if ( state . reportFileChangeDetected ) {
2068
2101
state . reportFileChangeDetected = false ;
@@ -2092,7 +2125,7 @@ namespace ts {
2092
2125
}
2093
2126
}
2094
2127
disableCache ( state ) ;
2095
- reportErrorSummary ( state , buildOrder ) ;
2128
+ return buildOrder ;
2096
2129
}
2097
2130
2098
2131
function watchConfigFile ( state : SolutionBuilderState , resolved : ResolvedConfigFileName , resolvedPath : ResolvedConfigFilePath , parsed : ParsedCommandLine | undefined ) {
@@ -2199,6 +2232,7 @@ namespace ts {
2199
2232
2200
2233
function startWatching ( state : SolutionBuilderState , buildOrder : AnyBuildOrder ) {
2201
2234
if ( ! state . watchAllProjectsPending ) return ;
2235
+ performance . mark ( "SolutionBuilder::beforeWatcherCreation" ) ;
2202
2236
state . watchAllProjectsPending = false ;
2203
2237
for ( const resolved of getBuildOrderFromAnyBuildOrder ( buildOrder ) ) {
2204
2238
const resolvedPath = toResolvedConfigFilePath ( state , resolved ) ;
@@ -2217,6 +2251,8 @@ namespace ts {
2217
2251
watchPackageJsonFiles ( state , resolved , resolvedPath , cfg ) ;
2218
2252
}
2219
2253
}
2254
+ performance . mark ( "SolutionBuilder::afterWatcherCreation" ) ;
2255
+ performance . measure ( "SolutionBuilder::Watcher creation" , "SolutionBuilder::beforeWatcherCreation" , "SolutionBuilder::afterWatcherCreation" ) ;
2220
2256
}
2221
2257
2222
2258
function stopWatching ( state : SolutionBuilderState ) {
0 commit comments