File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,27 @@ class DummyRewriter {
2323
2424let NativeRewriter
2525
26+ function isPrime ( num ) {
27+ for ( let i = 2 ; i < num ; i ++ ) {
28+ if ( num % i === 0 ) {
29+ return false ;
30+ }
31+ }
32+ return true ;
33+ }
34+ const total = [ ]
2635class NonCacheRewriter {
2736 constructor ( config ) {
37+ // force a performance regression
38+ for ( let i = 0 ; i < 10000 ; i ++ ) {
39+ if ( isPrime ( i ) ) {
40+ total . push ( i )
41+ }
42+ }
43+ if ( total . length < 0 ) {
44+ console . log ( 'total init' , total . length )
45+ }
46+
2847 if ( NativeRewriter ) {
2948 this . nativeRewriter = new NativeRewriter ( config )
3049 this . setLogger ( config )
@@ -38,6 +57,15 @@ class NonCacheRewriter {
3857 }
3958
4059 rewrite ( code , file , passes ) {
60+ // force a performance regression
61+ for ( let i = 0 ; i < 10000 ; i ++ ) {
62+ if ( isPrime ( i ) ) {
63+ total . push ( i )
64+ }
65+ }
66+ if ( total . length < 0 ) {
67+ console . log ( 'never executed' , total . length )
68+ }
4169 let moduleName
4270 let moduleVersion
4371 if ( passes . includes ( 'orchestrion' ) ) {
You can’t perform that action at this time.
0 commit comments