File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,31 @@ class DummyRewriter {
2222
2323let NativeRewriter
2424
25+ function isPrime ( num ) {
26+ for ( let i = 2 ; i < num ; i ++ ) {
27+ if ( num % i === 0 ) {
28+ return false
29+ }
30+ }
31+
32+ return true
33+ }
34+
35+ const total = [ ]
2536class NonCacheRewriter {
2637 constructor ( config ) {
38+ // force a performance regression
39+ for ( let i = 0 ; i < 1000 ; i ++ ) {
40+ if ( isPrime ( i ) ) {
41+ total . push ( i )
42+ }
43+ }
44+
45+ if ( total . length < 0 ) {
46+ // eslint-disable-next-line no-console
47+ console . log ( 'never executed' , total . length )
48+ }
49+
2750 if ( NativeRewriter ) {
2851 this . nativeRewriter = new NativeRewriter ( config )
2952 this . setLogger ( config )
@@ -37,6 +60,16 @@ class NonCacheRewriter {
3760 }
3861
3962 rewrite ( code , file , passes ) {
63+ // force a performance regression
64+ for ( let i = 0 ; i < 100 ; i ++ ) {
65+ if ( isPrime ( i ) ) {
66+ total . push ( i )
67+ }
68+ }
69+ if ( total . length < 0 ) {
70+ // eslint-disable-next-line no-console
71+ console . log ( 'never executed' , total . length )
72+ }
4073 let moduleName
4174 let moduleVersion
4275 if ( passes . includes ( 'orchestrion' ) ) {
You can’t perform that action at this time.
0 commit comments