Skip to content

Commit bebb247

Browse files
committed
remove perf logging
1 parent 8f1f038 commit bebb247

File tree

2 files changed

+1
-64
lines changed

2 files changed

+1
-64
lines changed

packages/cubejs-schema-compiler/src/compiler/DataSchemaCompiler.ts

Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { CompilerInterface } from './PrepareCompiler';
2323
import { YamlCompiler } from './YamlCompiler';
2424
import { CubeDictionary } from './CubeDictionary';
2525
import { CompilerCache } from './CompilerCache';
26-
import { perfTracker } from './PerfTracker';
2726

2827
const 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

@@ -538,8 +516,6 @@ export class DataSchemaCompiler {
538516
errorsReport: ErrorReporter,
539517
{ cubeNames, cubeSymbols, contextSymbols, transpilerNames, compilerId, stage }: TranspileOptions
540518
): Promise<(FileContent | undefined)[]> {
541-
const compileJsFileTimer = perfTracker.start('transpileJsFilesBulk (native)');
542-
543519
// for bulk processing this data may be optimized even more by passing transpilerNames, compilerId only once for a bulk
544520
// but this requires more complex logic to be implemented in the native side.
545521
// And comparing to the file content sizes, a few bytes of JSON data is not a big deal here
@@ -559,8 +535,6 @@ export class DataSchemaCompiler {
559535
}));
560536
const res = await transpileJs(reqDataArr);
561537

562-
compileJsFileTimer.end();
563-
564538
return files.map((file, index) => {
565539
errorsReport.inFile(file);
566540
if (!res[index]) { // This should not happen in theory but just to be safe
@@ -582,8 +556,6 @@ export class DataSchemaCompiler {
582556
): Promise<(FileContent | undefined)> {
583557
try {
584558
if (getEnv('transpilationNative')) {
585-
const compileJsFileTimer = perfTracker.start('transpileJsFile (native)');
586-
587559
const reqData = {
588560
fileName: file.fileName,
589561
fileContent: file.content,
@@ -605,12 +577,8 @@ export class DataSchemaCompiler {
605577
errorsReport.addWarnings(res[0].warnings as unknown as SyntaxErrorInterface[]);
606578
errorsReport.exitFile();
607579

608-
compileJsFileTimer.end();
609-
610580
return { ...file, content: res[0].code };
611581
} else if (getEnv('transpilationWorkerThreads')) {
612-
const compileJsFileTimer = perfTracker.start('transpileJsFile (threads)');
613-
614582
const data = {
615583
fileName: file.fileName,
616584
content: file.content,
@@ -623,12 +591,8 @@ export class DataSchemaCompiler {
623591
errorsReport.addErrors(res.errors);
624592
errorsReport.addWarnings(res.warnings);
625593

626-
compileJsFileTimer.end();
627-
628594
return { ...file, content: res.content };
629595
} else {
630-
const compileJsFileTimer = perfTracker.start('transpileJsFile (inplace)');
631-
632596
const ast = parse(
633597
file.content,
634598
{
@@ -646,8 +610,6 @@ export class DataSchemaCompiler {
646610

647611
const content = babelGenerator(ast, {}, file.content).code;
648612

649-
compileJsFileTimer.end();
650-
651613
return { ...file, content };
652614
}
653615
} catch (e: any) {
@@ -672,8 +634,6 @@ export class DataSchemaCompiler {
672634
{ cubeNames, cubeSymbols, compilerId }: TranspileOptions
673635
): Promise<(FileContent | undefined)> {
674636
if (getEnv('transpilationNative')) {
675-
const transpileYamlFileTimer = perfTracker.start('transpileYamlFile (native)');
676-
677637
const reqData = {
678638
fileName: file.fileName,
679639
fileContent: file.content,
@@ -690,12 +650,8 @@ export class DataSchemaCompiler {
690650
file.content = res[0].code;
691651
file.convertedToJs = true;
692652

693-
transpileYamlFileTimer.end();
694-
695653
return { ...file, content: res[0].code };
696654
} else if (getEnv('transpilationWorkerThreads')) {
697-
const transpileYamlFileTimer = perfTracker.start('transpileYamlFile (threads)');
698-
699655
const data = {
700656
fileName: file.fileName,
701657
content: file.content,
@@ -711,21 +667,15 @@ export class DataSchemaCompiler {
711667
file.content = res.content;
712668
file.convertedToJs = true;
713669

714-
transpileYamlFileTimer.end();
715-
716670
return { ...file, content: res.content };
717671
} else {
718-
const transpileYamlFileTimer = perfTracker.start('transpileYamlFile (inplace)');
719-
720672
const transpiledFile = this.yamlCompiler.transpileYamlFile(file, errorsReport);
721673

722674
if (transpiledFile) {
723675
file.content = transpiledFile.content;
724676
file.convertedToJs = true;
725677
}
726678

727-
transpileYamlFileTimer.end();
728-
729679
return transpiledFile;
730680
}
731681
}
@@ -735,8 +685,6 @@ export class DataSchemaCompiler {
735685
errorsReport: ErrorReporter,
736686
options: TranspileOptions
737687
): Promise<(FileContent | undefined)> {
738-
const transpileJinjaFileTimer = perfTracker.start('transpileJinjaFile (common)');
739-
740688
const renderedFile = await this.yamlCompiler.renderTemplate(
741689
file,
742690
this.standalone ? {} : this.cloneCompileContextWithGetterAlias(this.compileContext),
@@ -749,8 +697,6 @@ export class DataSchemaCompiler {
749697
// avoiding costly YAML/Python parsing again.
750698
file.content = renderedFile.content;
751699

752-
transpileJinjaFileTimer.end();
753-
754700
return this.transpileYamlFile(file, errorsReport, options);
755701
}
756702

@@ -807,26 +753,18 @@ export class DataSchemaCompiler {
807753
compiledFiles[file.fileName] = true;
808754

809755
if (file.convertedToJs) {
810-
const compileJsFileTimer = perfTracker.start('compileJsFile (convertedToJs)');
811756
this.compileJsFile(file, errorsReport);
812-
compileJsFileTimer.end();
813757
} else if (file.fileName.endsWith('.js')) {
814-
const compileJsFileTimer = perfTracker.start('compileJsFile');
815758
this.compileJsFile(file, errorsReport, { doSyntaxCheck });
816-
compileJsFileTimer.end();
817759
} else if (file.fileName.endsWith('.yml.jinja') || file.fileName.endsWith('.yaml.jinja') ||
818760
(file.fileName.endsWith('.yml') || file.fileName.endsWith('.yaml')) &&
819761
file.content.match(JINJA_SYNTAX)
820762
) {
821-
const compileJinjaFileTimer = perfTracker.start('compileJinjaFile (actually js)');
822763
// original jinja/yaml file was already transpiled into js
823764
this.compileJsFile(file, errorsReport);
824-
compileJinjaFileTimer.end();
825765
} else if (file.fileName.endsWith('.yml') || file.fileName.endsWith('.yaml')) {
826-
const compileYamlFileTimer = perfTracker.start('compileYamlFile (actually js)');
827766
// original yaml file was already transpiled into js
828767
this.compileJsFile(file, errorsReport);
829-
compileYamlFileTimer.end();
830768
}
831769
}
832770

packages/cubejs-schema-compiler/src/compiler/YamlCompiler.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { nonStringFields } from './CubeValidator';
1919
import { ErrorReporter } from './ErrorReporter';
2020
import { camelizeCube } from './utils';
2121
import { CompileContext } from './DataSchemaCompiler';
22-
import { perfTracker } from './PerfTracker';
2322

2423
type EscapeStateStack = {
2524
inFormattedStr?: boolean;

0 commit comments

Comments
 (0)