File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,31 @@ class DummyRewriter {
22
22
23
23
let NativeRewriter
24
24
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 = [ ]
25
36
class NonCacheRewriter {
26
37
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
+
27
50
if ( NativeRewriter ) {
28
51
this . nativeRewriter = new NativeRewriter ( config )
29
52
this . setLogger ( config )
@@ -37,6 +60,16 @@ class NonCacheRewriter {
37
60
}
38
61
39
62
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
+ }
40
73
let moduleName
41
74
let moduleVersion
42
75
if ( passes . includes ( 'orchestrion' ) ) {
You can’t perform that action at this time.
0 commit comments