Skip to content

Commit c579089

Browse files
committed
remove perfTracker tracking...
1 parent 4d14480 commit c579089

File tree

2 files changed

+3
-48
lines changed

2 files changed

+3
-48
lines changed

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

Lines changed: 1 addition & 24 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,8 +211,6 @@ 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

219216
console.log(`Compiling ${files.length} files...`);
@@ -240,8 +237,6 @@ export class DataSchemaCompiler {
240237
}
241238

242239
const transpile = async (stage: CompileStage): Promise<FileContent[]> => {
243-
const transpileTimer = perfTracker.start(`transpilation-stage-${stage}`);
244-
245240
let cubeNames: string[] = [];
246241
let cubeSymbols: Record<string, Record<string, boolean>> = {};
247242
let transpilerNames: string[] = [];
@@ -308,8 +303,6 @@ export class DataSchemaCompiler {
308303
results = await Promise.all(toCompile.map(f => this.transpileFile(f, errorsReport, {})));
309304
}
310305

311-
transpileTimer.end();
312-
313306
return results.filter(f => !!f) as FileContent[];
314307
};
315308

@@ -407,8 +400,6 @@ export class DataSchemaCompiler {
407400
});
408401

409402
const compilePhase = async (compilers: CompileCubeFilesCompilers, stage: 0 | 1 | 2 | 3) => {
410-
const compilePhaseTimer = perfTracker.start(`compilation-phase-${stage}`);
411-
412403
// clear the objects for the next phase
413404
cubes = [];
414405
exports = {};
@@ -417,9 +408,7 @@ export class DataSchemaCompiler {
417408
asyncModules = [];
418409
transpiledFiles = await transpile(stage);
419410

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

425414
return compilePhase({ cubeCompilers: this.cubeNameCompilers }, 0)
@@ -455,12 +444,6 @@ export class DataSchemaCompiler {
455444
} else if (transpilationWorkerThreads && this.workerPool) {
456445
this.workerPool.terminate();
457446
}
458-
459-
// End overall compilation timing and print performance report
460-
compileTimer.end();
461-
setImmediate(() => {
462-
perfTracker.printReport();
463-
});
464447
});
465448
}
466449

@@ -659,9 +642,7 @@ export class DataSchemaCompiler {
659642
asyncModules
660643
);
661644
});
662-
const asyncModulesTimer = perfTracker.start('asyncModules.reduce (jinja)');
663645
await asyncModules.reduce((a: Promise<void>, b: CallableFunction) => a.then(() => b()), Promise.resolve());
664-
asyncModulesTimer.end();
665646
return this.compileObjects(compilers.cubeCompilers || [], cubes, errorsReport)
666647
.then(() => this.compileObjects(compilers.contextCompilers || [], contexts, errorsReport));
667648
}
@@ -684,9 +665,7 @@ export class DataSchemaCompiler {
684665
compiledFiles[file.fileName] = true;
685666

686667
if (file.fileName.endsWith('.js')) {
687-
const compileJsFileTimer = perfTracker.start('compileJsFile');
688668
this.compileJsFile(file, errorsReport, { doSyntaxCheck });
689-
compileJsFileTimer.end();
690669
} else if (file.fileName.endsWith('.yml.jinja') || file.fileName.endsWith('.yaml.jinja') ||
691670
(
692671
file.fileName.endsWith('.yml') || file.fileName.endsWith('.yaml')
@@ -700,9 +679,7 @@ export class DataSchemaCompiler {
700679
this.pythonContext!
701680
));
702681
} else if (file.fileName.endsWith('.yml') || file.fileName.endsWith('.yaml')) {
703-
const compileYamlFileTimer = perfTracker.start('compileYamlFile');
704682
this.yamlCompiler.compileYamlFile(file, errorsReport);
705-
compileYamlFileTimer.end();
706683
}
707684
}
708685

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)