File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -25,14 +25,20 @@ try {
25
25
isBound : false ,
26
26
} ;
27
27
}
28
+ const skipOptimization = process . env . CODSPEED_FORCE_OPTIMIZATION !== "true" ;
28
29
export const measurement = m ;
29
30
export const initCore = ( ) => {
30
- // eslint-disable-next-line @typescript-eslint/no-var-requires
31
- require ( "v8" ) . setFlagsFromString ( "--allow-natives-syntax" ) ;
31
+ if ( ! skipOptimization ) {
32
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
33
+ require ( "v8" ) . setFlagsFromString ( "--allow-natives-syntax" ) ;
34
+ }
32
35
measurement . stopInstrumentation ( `Metadata: codspeed-node ${ __VERSION__ } ` ) ;
33
36
} ;
34
37
35
38
export const optimizeFunction = async ( fn : CallableFunction ) => {
39
+ if ( skipOptimization ) {
40
+ return ;
41
+ }
36
42
// Source: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#optimization-killers
37
43
await fn ( ) ; //Fill type-info
38
44
await fn ( ) ; // 2 calls are needed to go from uninitialized -> pre-monomorphic -> monomorphic
@@ -41,6 +47,9 @@ export const optimizeFunction = async (fn: CallableFunction) => {
41
47
} ;
42
48
43
49
export const optimizeFunctionSync = ( fn : CallableFunction ) => {
50
+ if ( skipOptimization ) {
51
+ return ;
52
+ }
44
53
// Source: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#optimization-killers
45
54
fn ( ) ; //Fill type-info
46
55
fn ( ) ; // 2 calls are needed to go from uninitialized -> pre-monomorphic -> monomorphic
You can’t perform that action at this time.
0 commit comments