Skip to content

Commit 3487bba

Browse files
committed
remove perfTracker tracking...
1 parent e9d1711 commit 3487bba

File tree

2 files changed

+3
-50
lines changed

2 files changed

+3
-50
lines changed

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

Lines changed: 1 addition & 26 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

@@ -212,12 +211,8 @@ export class DataSchemaCompiler {
212211
}
213212

214213
protected async doCompile() {
215-
const compileTimer = perfTracker.start('doCompile', true);
216-
217214
const files = await this.repository.dataSchemaFiles();
218215

219-
console.log(`Compiling ${files.length} files...`);
220-
221216
this.pythonContext = await this.loadPythonContext(files, 'globals.py');
222217
this.yamlCompiler.initFromPythonContext(this.pythonContext);
223218

@@ -240,8 +235,6 @@ export class DataSchemaCompiler {
240235
}
241236

242237
const transpile = async (stage: CompileStage): Promise<FileContent[]> => {
243-
const transpileTimer = perfTracker.start(`transpilation-stage-${stage}`);
244-
245238
let cubeNames: string[] = [];
246239
let cubeSymbols: Record<string, Record<string, boolean>> = {};
247240
let transpilerNames: string[] = [];
@@ -308,8 +301,6 @@ export class DataSchemaCompiler {
308301
results = await Promise.all(toCompile.map(f => this.transpileFile(f, errorsReport, {})));
309302
}
310303

311-
transpileTimer.end();
312-
313304
return results.filter(f => !!f) as FileContent[];
314305
};
315306

@@ -407,8 +398,6 @@ export class DataSchemaCompiler {
407398
});
408399

409400
const compilePhase = async (compilers: CompileCubeFilesCompilers, stage: 0 | 1 | 2 | 3) => {
410-
const compilePhaseTimer = perfTracker.start(`compilation-phase-${stage}`);
411-
412401
// clear the objects for the next phase
413402
cubes = [];
414403
exports = {};
@@ -417,9 +406,7 @@ export class DataSchemaCompiler {
417406
asyncModules = [];
418407
transpiledFiles = await transpile(stage);
419408

420-
const res = this.compileCubeFiles(cubes, contexts, compiledFiles, asyncModules, compilers, transpiledFiles, errorsReport);
421-
compilePhaseTimer.end();
422-
return res;
409+
return this.compileCubeFiles(cubes, contexts, compiledFiles, asyncModules, compilers, transpiledFiles, errorsReport);
423410
};
424411

425412
return compilePhase({ cubeCompilers: this.cubeNameCompilers }, 0)
@@ -455,12 +442,6 @@ export class DataSchemaCompiler {
455442
} else if (transpilationWorkerThreads && this.workerPool) {
456443
this.workerPool.terminate();
457444
}
458-
459-
// End overall compilation timing and print performance report
460-
compileTimer.end();
461-
setImmediate(() => {
462-
perfTracker.printReport();
463-
});
464445
});
465446
}
466447

@@ -659,9 +640,7 @@ export class DataSchemaCompiler {
659640
asyncModules
660641
);
661642
});
662-
const asyncModulesTimer = perfTracker.start('asyncModules.reduce (jinja)');
663643
await asyncModules.reduce((a: Promise<void>, b: CallableFunction) => a.then(() => b()), Promise.resolve());
664-
asyncModulesTimer.end();
665644
return this.compileObjects(compilers.cubeCompilers || [], cubes, errorsReport)
666645
.then(() => this.compileObjects(compilers.contextCompilers || [], contexts, errorsReport));
667646
}
@@ -684,9 +663,7 @@ export class DataSchemaCompiler {
684663
compiledFiles[file.fileName] = true;
685664

686665
if (file.fileName.endsWith('.js')) {
687-
const compileJsFileTimer = perfTracker.start('compileJsFile');
688666
this.compileJsFile(file, errorsReport, { doSyntaxCheck });
689-
compileJsFileTimer.end();
690667
} else if (file.fileName.endsWith('.yml.jinja') || file.fileName.endsWith('.yaml.jinja') ||
691668
(
692669
file.fileName.endsWith('.yml') || file.fileName.endsWith('.yaml')
@@ -700,9 +677,7 @@ export class DataSchemaCompiler {
700677
this.pythonContext!
701678
));
702679
} else if (file.fileName.endsWith('.yml') || file.fileName.endsWith('.yaml')) {
703-
const compileYamlFileTimer = perfTracker.start('compileYamlFile');
704680
this.yamlCompiler.compileYamlFile(file, errorsReport);
705-
compileYamlFileTimer.end();
706681
}
707682
}
708683

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

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { nonStringFields } from './CubeValidator';
1616
import { CubeDictionary } from './CubeDictionary';
1717
import { ErrorReporter } from './ErrorReporter';
1818
import { camelizeCube } from './utils';
19-
import { perfTracker } from './PerfTracker';
2019

2120
type EscapeStateStack = {
2221
inFormattedStr?: boolean;
@@ -93,9 +92,7 @@ export class YamlCompiler {
9392
for (const key of Object.keys(yamlObj)) {
9493
if (key === 'cubes') {
9594
(yamlObj.cubes || []).forEach(({ name, ...cube }) => {
96-
const transpileAndPrepareJsFileTimer = perfTracker.start('yaml-transpileAndPrepareJsFile');
9795
const transpiledFile = this.transpileAndPrepareJsFile(file, 'cube', { name, ...cube }, errorsReport);
98-
transpileAndPrepareJsFileTimer.end();
9996
this.dataSchemaCompiler?.compileJsFile(transpiledFile, errorsReport);
10097
});
10198
} else if (key === 'views') {
@@ -137,10 +134,7 @@ export class YamlCompiler {
137134

138135
cubeObj.hierarchies = this.yamlArrayToObj(cubeObj.hierarchies || [], 'hierarchies', errorsReport);
139136

140-
const transpileYamlTimer = perfTracker.start('transpileYaml');
141-
const res = this.transpileYaml(cubeObj, [], cubeObj.name, errorsReport);
142-
transpileYamlTimer.end();
143-
return res;
137+
return this.transpileYaml(cubeObj, [], cubeObj.name, errorsReport);
144138
}
145139

146140
private transpileYaml(obj, propertyPath, cubeName, errorsReport: ErrorReporter) {
@@ -169,9 +163,7 @@ export class YamlCompiler {
169163
if (propertyPath[propertyPath.length - 1] === 'values') {
170164
if (typeof code === 'string') {
171165
if (code.match(PY_TEMPLATE_SYNTAX)) {
172-
const parsePythonAndTranspileToJsTimer184 = perfTracker.start('parsePythonAndTranspileToJs call 184');
173166
ast = this.parsePythonAndTranspileToJs(`f"${this.escapeDoubleQuotes(code)}"`, errorsReport);
174-
parsePythonAndTranspileToJsTimer184.end();
175167
} else {
176168
ast = t.stringLiteral(code);
177169
}
@@ -186,9 +178,7 @@ export class YamlCompiler {
186178
}
187179
}
188180
if (ast === null) {
189-
const parsePythonAndTranspileToJsTimer201 = perfTracker.start('parsePythonAndTranspileToJs call 201');
190181
ast = this.parsePythonAndTranspileToJs(code, errorsReport);
191-
parsePythonAndTranspileToJsTimer201.end();
192182
}
193183
return this.extractProgramBodyIfNeeded(ast);
194184
}).filter(ast => !!ast)))]);
@@ -199,9 +189,7 @@ export class YamlCompiler {
199189
}
200190

201191
if (propertyPath[propertyPath.length - 1] === 'extends') {
202-
const parsePythonAndTranspileToJsTimer214 = perfTracker.start('parsePythonAndTranspileToJs call 214');
203192
const ast = this.parsePythonAndTranspileToJs(obj, errorsReport);
204-
parsePythonAndTranspileToJsTimer214.end();
205193
return this.astIntoArrowFunction(ast, obj, cubeName, name => this.cubeDictionary.resolveCube(name));
206194
} else if (typeof obj === 'string') {
207195
let code = obj;
@@ -215,9 +203,7 @@ export class YamlCompiler {
215203
code = `f"${this.escapeDoubleQuotes(obj)}"`;
216204
}
217205

218-
const parsePythonAndTranspileToJsTimer225 = perfTracker.start('parsePythonAndTranspileToJs call 225');
219206
const ast = this.parsePythonAndTranspileToJs(code, errorsReport);
220-
parsePythonAndTranspileToJsTimer225.end();
221207
return this.extractProgramBodyIfNeeded(ast);
222208
}
223209

@@ -302,9 +288,7 @@ export class YamlCompiler {
302288
}
303289

304290
private parsePythonIntoArrowFunction(codeString: string, cubeName, originalObj, errorsReport: ErrorReporter) {
305-
const parsePythonAndTranspileToJsTimer301 = perfTracker.start('parsePythonAndTranspileToJs call 301');
306291
const ast = this.parsePythonAndTranspileToJs(codeString, errorsReport);
307-
parsePythonAndTranspileToJsTimer301.end();
308292
return this.astIntoArrowFunction(ast as any, codeString, cubeName);
309293
}
310294

@@ -314,12 +298,8 @@ export class YamlCompiler {
314298
}
315299

316300
try {
317-
const parsePythonAndTranspileToJsTimer = perfTracker.start('PythonParser->transpileToJs()');
318-
319301
const pythonParser = new PythonParser(codeString);
320-
const res = pythonParser.transpileToJs();
321-
parsePythonAndTranspileToJsTimer.end();
322-
return res;
302+
return pythonParser.transpileToJs();
323303
} catch (e: any) {
324304
errorsReport.error(`Can't parse python expression. Most likely this type of syntax isn't supported yet: ${e.message || e}`);
325305
}
@@ -328,7 +308,6 @@ export class YamlCompiler {
328308
}
329309

330310
private astIntoArrowFunction(input: t.Program | t.NullLiteral, codeString: string, cubeName, resolveSymbol?: (string) => any) {
331-
const astIntoArrowFunctionTimer = perfTracker.start('astIntoArrowFunction');
332311
const initialJs = babelGenerator(input, {}, codeString).code;
333312

334313
// Re-parse generated JS to set all necessary parent paths
@@ -353,7 +332,6 @@ export class YamlCompiler {
353332
babelTraverse(ast, traverseObj);
354333

355334
const body: any = ast.program.body[0];
356-
astIntoArrowFunctionTimer.end();
357335
return body?.expression;
358336
}
359337

0 commit comments

Comments
 (0)