@@ -648,21 +648,22 @@ namespace ts {
648648 reportStatisticalValue ( "Memory used" , Math . round ( memoryUsed / 1000 ) + "K" ) ;
649649 }
650650
651- const programTime = performance . isEnabled ( ) ? performance . getDuration ( "Program" ) : 0 ;
652- const bindTime = performance . isEnabled ( ) ? performance . getDuration ( "Bind" ) : 0 ;
653- const checkTime = performance . isEnabled ( ) ? performance . getDuration ( "Check" ) : 0 ;
654- const emitTime = performance . isEnabled ( ) ? performance . getDuration ( "Emit" ) : 0 ;
651+ const isPerformanceEnabled = performance . isEnabled ( ) ;
652+ const programTime = isPerformanceEnabled ? performance . getDuration ( "Program" ) : 0 ;
653+ const bindTime = isPerformanceEnabled ? performance . getDuration ( "Bind" ) : 0 ;
654+ const checkTime = isPerformanceEnabled ? performance . getDuration ( "Check" ) : 0 ;
655+ const emitTime = isPerformanceEnabled ? performance . getDuration ( "Emit" ) : 0 ;
655656 if ( compilerOptions . extendedDiagnostics ) {
656657 const caches = program . getRelationCacheSizes ( ) ;
657658 reportCountStatistic ( "Assignability cache size" , caches . assignable ) ;
658659 reportCountStatistic ( "Identity cache size" , caches . identity ) ;
659660 reportCountStatistic ( "Subtype cache size" , caches . subtype ) ;
660661 reportCountStatistic ( "Strict subtype cache size" , caches . strictSubtype ) ;
661- if ( performance . isEnabled ( ) ) {
662+ if ( isPerformanceEnabled ) {
662663 performance . forEachMeasure ( ( name , duration ) => reportTimeStatistic ( `${ name } time` , duration ) ) ;
663664 }
664665 }
665- else if ( performance . isEnabled ( ) ) {
666+ else if ( isPerformanceEnabled ) {
666667 // Individual component times.
667668 // Note: To match the behavior of previous versions of the compiler, the reported parse time includes
668669 // I/O read time and processing time for triple-slash references and module imports, and the reported
@@ -674,11 +675,11 @@ namespace ts {
674675 reportTimeStatistic ( "Check time" , checkTime ) ;
675676 reportTimeStatistic ( "Emit time" , emitTime ) ;
676677 }
677- if ( performance . isEnabled ( ) ) {
678+ if ( isPerformanceEnabled ) {
678679 reportTimeStatistic ( "Total time" , programTime + bindTime + checkTime + emitTime ) ;
679680 }
680681 reportStatistics ( ) ;
681- if ( ! performance . isEnabled ( ) ) {
682+ if ( ! isPerformanceEnabled ) {
682683 sys . write ( Diagnostics . Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found . message + "\n" ) ;
683684 }
684685 else {
0 commit comments