@@ -23,7 +23,6 @@ import { CompilerInterface } from './PrepareCompiler';
2323import { YamlCompiler } from './YamlCompiler' ;
2424import { CubeDictionary } from './CubeDictionary' ;
2525import { CompilerCache } from './CompilerCache' ;
26- import { perfTracker } from './PerfTracker' ;
2726
2827const ctxFileStorage = new AsyncLocalStorage < FileContent > ( ) ;
2928
@@ -215,18 +214,13 @@ export class DataSchemaCompiler {
215214 protected async doCompile ( ) {
216215 const files = await this . repository . dataSchemaFiles ( ) ;
217216
218- console . log ( `Compiling ${ files . length } files...` ) ;
219- const compileTimer = perfTracker . start ( 'doCompile' , true ) ;
220-
221217 this . pythonContext = await this . loadPythonContext ( files , 'globals.py' ) ;
222218 this . yamlCompiler . initFromPythonContext ( this . pythonContext ) ;
223219
224220 const toCompile = this . filesToCompile ?. length
225221 ? files . filter ( f => this . filesToCompile . includes ( f . fileName ) )
226222 : files ;
227223
228- const jinjaLoaderTimer = perfTracker . start ( 'loadJinjaTemplates' ) ;
229-
230224 const jinjaTemplatedFiles = toCompile . filter ( ( file ) => file . fileName . endsWith ( '.jinja' ) ||
231225 ( file . fileName . endsWith ( '.yml' ) || file . fileName . endsWith ( '.yaml' ) ) && file . content . match ( JINJA_SYNTAX ) ) ;
232226
@@ -235,8 +229,6 @@ export class DataSchemaCompiler {
235229 this . loadJinjaTemplates ( jinjaTemplatedFiles ) ;
236230 }
237231
238- jinjaLoaderTimer . end ( ) ;
239-
240232 const errorsReport = new ErrorReporter ( null , [ ] , this . errorReportOptions ) ;
241233 this . errorsReporter = errorsReport ;
242234
@@ -254,8 +246,6 @@ export class DataSchemaCompiler {
254246 }
255247
256248 const transpile = async ( stage : CompileStage ) : Promise < FileContent [ ] > => {
257- const transpileTimer = perfTracker . start ( `transpilation-stage-${ stage } ` ) ;
258-
259249 let cubeNames : string [ ] = [ ] ;
260250 let cubeSymbols : Record < string , Record < string , boolean > > = { } ;
261251 let transpilerNames : string [ ] = [ ] ;
@@ -322,8 +312,6 @@ export class DataSchemaCompiler {
322312 results = await Promise . all ( toCompile . map ( f => this . transpileFile ( f , errorsReport , { } ) ) ) ;
323313 }
324314
325- transpileTimer . end ( ) ;
326-
327315 return results . filter ( f => ! ! f ) as FileContent [ ] ;
328316 } ;
329317
@@ -420,8 +408,6 @@ export class DataSchemaCompiler {
420408 } ) ;
421409
422410 const compilePhase = async ( compilers : CompileCubeFilesCompilers , stage : 0 | 1 | 2 | 3 ) => {
423- const compilePhaseTimer = perfTracker . start ( `compilation-phase-${ stage } ` ) ;
424-
425411 // clear the objects for the next phase
426412 cubes = [ ] ;
427413 exports = { } ;
@@ -430,9 +416,7 @@ export class DataSchemaCompiler {
430416 asyncModules = [ ] ;
431417 transpiledFiles = await transpile ( stage ) ;
432418
433- const res = this . compileCubeFiles ( cubes , contexts , compiledFiles , asyncModules , compilers , transpiledFiles , errorsReport ) ;
434- compilePhaseTimer . end ( ) ;
435- return res ;
419+ return this . compileCubeFiles ( cubes , contexts , compiledFiles , asyncModules , compilers , transpiledFiles , errorsReport ) ;
436420 } ;
437421
438422 return compilePhase ( { cubeCompilers : this . cubeNameCompilers } , 0 )
@@ -468,12 +452,6 @@ export class DataSchemaCompiler {
468452 } else if ( transpilationWorkerThreads && this . workerPool ) {
469453 this . workerPool . terminate ( ) ;
470454 }
471-
472- // End overall compilation timing and print performance report
473- compileTimer . end ( ) ;
474- setImmediate ( ( ) => {
475- perfTracker . printReport ( ) ;
476- } ) ;
477455 } ) ;
478456 }
479457
@@ -504,7 +482,6 @@ export class DataSchemaCompiler {
504482
505483 const jinjaEngine = this . yamlCompiler . getJinjaEngine ( ) ;
506484
507- // XXX: Make this as bulk operation in the native side
508485 files . forEach ( ( file ) => {
509486 jinjaEngine . loadTemplate ( file . fileName , file . content ) ;
510487 } ) ;
@@ -538,8 +515,6 @@ export class DataSchemaCompiler {
538515 errorsReport : ErrorReporter ,
539516 { cubeNames, cubeSymbols, contextSymbols, transpilerNames, compilerId, stage } : TranspileOptions
540517 ) : Promise < ( FileContent | undefined ) [ ] > {
541- const compileJsFileTimer = perfTracker . start ( 'transpileJsFilesBulk (native)' ) ;
542-
543518 // for bulk processing this data may be optimized even more by passing transpilerNames, compilerId only once for a bulk
544519 // but this requires more complex logic to be implemented in the native side.
545520 // And comparing to the file content sizes, a few bytes of JSON data is not a big deal here
@@ -559,8 +534,6 @@ export class DataSchemaCompiler {
559534 } ) ) ;
560535 const res = await transpileJs ( reqDataArr ) ;
561536
562- compileJsFileTimer . end ( ) ;
563-
564537 return files . map ( ( file , index ) => {
565538 errorsReport . inFile ( file ) ;
566539 if ( ! res [ index ] ) { // This should not happen in theory but just to be safe
@@ -582,8 +555,6 @@ export class DataSchemaCompiler {
582555 ) : Promise < ( FileContent | undefined ) > {
583556 try {
584557 if ( getEnv ( 'transpilationNative' ) ) {
585- const compileJsFileTimer = perfTracker . start ( 'transpileJsFile (native)' ) ;
586-
587558 const reqData = {
588559 fileName : file . fileName ,
589560 fileContent : file . content ,
@@ -605,12 +576,8 @@ export class DataSchemaCompiler {
605576 errorsReport . addWarnings ( res [ 0 ] . warnings as unknown as SyntaxErrorInterface [ ] ) ;
606577 errorsReport . exitFile ( ) ;
607578
608- compileJsFileTimer . end ( ) ;
609-
610579 return { ...file , content : res [ 0 ] . code } ;
611580 } else if ( getEnv ( 'transpilationWorkerThreads' ) ) {
612- const compileJsFileTimer = perfTracker . start ( 'transpileJsFile (threads)' ) ;
613-
614581 const data = {
615582 fileName : file . fileName ,
616583 content : file . content ,
@@ -623,12 +590,8 @@ export class DataSchemaCompiler {
623590 errorsReport . addErrors ( res . errors ) ;
624591 errorsReport . addWarnings ( res . warnings ) ;
625592
626- compileJsFileTimer . end ( ) ;
627-
628593 return { ...file , content : res . content } ;
629594 } else {
630- const compileJsFileTimer = perfTracker . start ( 'transpileJsFile (inplace)' ) ;
631-
632595 const ast = parse (
633596 file . content ,
634597 {
@@ -646,8 +609,6 @@ export class DataSchemaCompiler {
646609
647610 const content = babelGenerator ( ast , { } , file . content ) . code ;
648611
649- compileJsFileTimer . end ( ) ;
650-
651612 return { ...file , content } ;
652613 }
653614 } catch ( e : any ) {
@@ -672,8 +633,6 @@ export class DataSchemaCompiler {
672633 { cubeNames, cubeSymbols, compilerId } : TranspileOptions
673634 ) : Promise < ( FileContent | undefined ) > {
674635 if ( getEnv ( 'transpilationNative' ) ) {
675- const transpileYamlFileTimer = perfTracker . start ( 'transpileYamlFile (native)' ) ;
676-
677636 const reqData = {
678637 fileName : file . fileName ,
679638 fileContent : file . content ,
@@ -690,12 +649,8 @@ export class DataSchemaCompiler {
690649 file . content = res [ 0 ] . code ;
691650 file . convertedToJs = true ;
692651
693- transpileYamlFileTimer . end ( ) ;
694-
695652 return { ...file , content : res [ 0 ] . code } ;
696653 } else if ( getEnv ( 'transpilationWorkerThreads' ) ) {
697- const transpileYamlFileTimer = perfTracker . start ( 'transpileYamlFile (threads)' ) ;
698-
699654 const data = {
700655 fileName : file . fileName ,
701656 content : file . content ,
@@ -711,21 +666,15 @@ export class DataSchemaCompiler {
711666 file . content = res . content ;
712667 file . convertedToJs = true ;
713668
714- transpileYamlFileTimer . end ( ) ;
715-
716669 return { ...file , content : res . content } ;
717670 } else {
718- const transpileYamlFileTimer = perfTracker . start ( 'transpileYamlFile (inplace)' ) ;
719-
720671 const transpiledFile = this . yamlCompiler . transpileYamlFile ( file , errorsReport ) ;
721672
722673 if ( transpiledFile ) {
723674 file . content = transpiledFile . content ;
724675 file . convertedToJs = true ;
725676 }
726677
727- transpileYamlFileTimer . end ( ) ;
728-
729678 return transpiledFile ;
730679 }
731680 }
@@ -735,8 +684,6 @@ export class DataSchemaCompiler {
735684 errorsReport : ErrorReporter ,
736685 options : TranspileOptions
737686 ) : Promise < ( FileContent | undefined ) > {
738- const transpileJinjaFileTimer = perfTracker . start ( 'transpileJinjaFile (common)' ) ;
739-
740687 const renderedFile = await this . yamlCompiler . renderTemplate (
741688 file ,
742689 this . standalone ? { } : this . cloneCompileContextWithGetterAlias ( this . compileContext ) ,
@@ -749,8 +696,6 @@ export class DataSchemaCompiler {
749696 // avoiding costly YAML/Python parsing again.
750697 file . content = renderedFile . content ;
751698
752- transpileJinjaFileTimer . end ( ) ;
753-
754699 return this . transpileYamlFile ( file , errorsReport , options ) ;
755700 }
756701
@@ -807,26 +752,18 @@ export class DataSchemaCompiler {
807752 compiledFiles [ file . fileName ] = true ;
808753
809754 if ( file . convertedToJs ) {
810- const compileJsFileTimer = perfTracker . start ( 'compileJsFile (convertedToJs)' ) ;
811755 this . compileJsFile ( file , errorsReport ) ;
812- compileJsFileTimer . end ( ) ;
813756 } else if ( file . fileName . endsWith ( '.js' ) ) {
814- const compileJsFileTimer = perfTracker . start ( 'compileJsFile' ) ;
815757 this . compileJsFile ( file , errorsReport , { doSyntaxCheck } ) ;
816- compileJsFileTimer . end ( ) ;
817758 } else if ( file . fileName . endsWith ( '.yml.jinja' ) || file . fileName . endsWith ( '.yaml.jinja' ) ||
818759 ( file . fileName . endsWith ( '.yml' ) || file . fileName . endsWith ( '.yaml' ) ) &&
819760 file . content . match ( JINJA_SYNTAX )
820761 ) {
821- const compileJinjaFileTimer = perfTracker . start ( 'compileJinjaFile (actually js)' ) ;
822762 // original jinja/yaml file was already transpiled into js
823763 this . compileJsFile ( file , errorsReport ) ;
824- compileJinjaFileTimer . end ( ) ;
825764 } else if ( file . fileName . endsWith ( '.yml' ) || file . fileName . endsWith ( '.yaml' ) ) {
826- const compileYamlFileTimer = perfTracker . start ( 'compileYamlFile (actually js)' ) ;
827765 // original yaml file was already transpiled into js
828766 this . compileJsFile ( file , errorsReport ) ;
829- compileYamlFileTimer . end ( ) ;
830767 }
831768 }
832769
0 commit comments