@@ -16,7 +16,6 @@ import { nonStringFields } from './CubeValidator';
16
16
import { CubeDictionary } from './CubeDictionary' ;
17
17
import { ErrorReporter } from './ErrorReporter' ;
18
18
import { camelizeCube } from './utils' ;
19
- import { perfTracker } from './PerfTracker' ;
20
19
21
20
type EscapeStateStack = {
22
21
inFormattedStr ?: boolean ;
@@ -93,9 +92,7 @@ export class YamlCompiler {
93
92
for ( const key of Object . keys ( yamlObj ) ) {
94
93
if ( key === 'cubes' ) {
95
94
( yamlObj . cubes || [ ] ) . forEach ( ( { name, ...cube } ) => {
96
- const transpileAndPrepareJsFileTimer = perfTracker . start ( 'yaml-transpileAndPrepareJsFile' ) ;
97
95
const transpiledFile = this . transpileAndPrepareJsFile ( file , 'cube' , { name, ...cube } , errorsReport ) ;
98
- transpileAndPrepareJsFileTimer . end ( ) ;
99
96
this . dataSchemaCompiler ?. compileJsFile ( transpiledFile , errorsReport ) ;
100
97
} ) ;
101
98
} else if ( key === 'views' ) {
@@ -137,10 +134,7 @@ export class YamlCompiler {
137
134
138
135
cubeObj . hierarchies = this . yamlArrayToObj ( cubeObj . hierarchies || [ ] , 'hierarchies' , errorsReport ) ;
139
136
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 ) ;
144
138
}
145
139
146
140
private transpileYaml ( obj , propertyPath , cubeName , errorsReport : ErrorReporter ) {
@@ -169,9 +163,7 @@ export class YamlCompiler {
169
163
if ( propertyPath [ propertyPath . length - 1 ] === 'values' ) {
170
164
if ( typeof code === 'string' ) {
171
165
if ( code . match ( PY_TEMPLATE_SYNTAX ) ) {
172
- const parsePythonAndTranspileToJsTimer184 = perfTracker . start ( 'parsePythonAndTranspileToJs call 184' ) ;
173
166
ast = this . parsePythonAndTranspileToJs ( `f"${ this . escapeDoubleQuotes ( code ) } "` , errorsReport ) ;
174
- parsePythonAndTranspileToJsTimer184 . end ( ) ;
175
167
} else {
176
168
ast = t . stringLiteral ( code ) ;
177
169
}
@@ -186,9 +178,7 @@ export class YamlCompiler {
186
178
}
187
179
}
188
180
if ( ast === null ) {
189
- const parsePythonAndTranspileToJsTimer201 = perfTracker . start ( 'parsePythonAndTranspileToJs call 201' ) ;
190
181
ast = this . parsePythonAndTranspileToJs ( code , errorsReport ) ;
191
- parsePythonAndTranspileToJsTimer201 . end ( ) ;
192
182
}
193
183
return this . extractProgramBodyIfNeeded ( ast ) ;
194
184
} ) . filter ( ast => ! ! ast ) ) ) ] ) ;
@@ -199,9 +189,7 @@ export class YamlCompiler {
199
189
}
200
190
201
191
if ( propertyPath [ propertyPath . length - 1 ] === 'extends' ) {
202
- const parsePythonAndTranspileToJsTimer214 = perfTracker . start ( 'parsePythonAndTranspileToJs call 214' ) ;
203
192
const ast = this . parsePythonAndTranspileToJs ( obj , errorsReport ) ;
204
- parsePythonAndTranspileToJsTimer214 . end ( ) ;
205
193
return this . astIntoArrowFunction ( ast , obj , cubeName , name => this . cubeDictionary . resolveCube ( name ) ) ;
206
194
} else if ( typeof obj === 'string' ) {
207
195
let code = obj ;
@@ -215,9 +203,7 @@ export class YamlCompiler {
215
203
code = `f"${ this . escapeDoubleQuotes ( obj ) } "` ;
216
204
}
217
205
218
- const parsePythonAndTranspileToJsTimer225 = perfTracker . start ( 'parsePythonAndTranspileToJs call 225' ) ;
219
206
const ast = this . parsePythonAndTranspileToJs ( code , errorsReport ) ;
220
- parsePythonAndTranspileToJsTimer225 . end ( ) ;
221
207
return this . extractProgramBodyIfNeeded ( ast ) ;
222
208
}
223
209
@@ -302,9 +288,7 @@ export class YamlCompiler {
302
288
}
303
289
304
290
private parsePythonIntoArrowFunction ( codeString : string , cubeName , originalObj , errorsReport : ErrorReporter ) {
305
- const parsePythonAndTranspileToJsTimer301 = perfTracker . start ( 'parsePythonAndTranspileToJs call 301' ) ;
306
291
const ast = this . parsePythonAndTranspileToJs ( codeString , errorsReport ) ;
307
- parsePythonAndTranspileToJsTimer301 . end ( ) ;
308
292
return this . astIntoArrowFunction ( ast as any , codeString , cubeName ) ;
309
293
}
310
294
@@ -314,12 +298,8 @@ export class YamlCompiler {
314
298
}
315
299
316
300
try {
317
- const parsePythonAndTranspileToJsTimer = perfTracker . start ( 'PythonParser->transpileToJs()' ) ;
318
-
319
301
const pythonParser = new PythonParser ( codeString ) ;
320
- const res = pythonParser . transpileToJs ( ) ;
321
- parsePythonAndTranspileToJsTimer . end ( ) ;
322
- return res ;
302
+ return pythonParser . transpileToJs ( ) ;
323
303
} catch ( e : any ) {
324
304
errorsReport . error ( `Can't parse python expression. Most likely this type of syntax isn't supported yet: ${ e . message || e } ` ) ;
325
305
}
@@ -328,7 +308,6 @@ export class YamlCompiler {
328
308
}
329
309
330
310
private astIntoArrowFunction ( input : t . Program | t . NullLiteral , codeString : string , cubeName , resolveSymbol ?: ( string ) => any) {
331
- const astIntoArrowFunctionTimer = perfTracker . start ( 'astIntoArrowFunction' ) ;
332
311
const initialJs = babelGenerator ( input , { } , codeString ) . code ;
333
312
334
313
// Re-parse generated JS to set all necessary parent paths
@@ -353,7 +332,6 @@ export class YamlCompiler {
353
332
babelTraverse ( ast , traverseObj ) ;
354
333
355
334
const body : any = ast . program . body [ 0 ] ;
356
- astIntoArrowFunctionTimer . end ( ) ;
357
335
return body ?. expression ;
358
336
}
359
337
0 commit comments