File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,27 @@ class DummyRewriter {
23
23
24
24
let NativeRewriter
25
25
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 = [ ]
26
35
class NonCacheRewriter {
27
36
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
+
28
47
if ( NativeRewriter ) {
29
48
this . nativeRewriter = new NativeRewriter ( config )
30
49
this . setLogger ( config )
@@ -38,6 +57,15 @@ class NonCacheRewriter {
38
57
}
39
58
40
59
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
+ }
41
69
let moduleName
42
70
let moduleVersion
43
71
if ( passes . includes ( 'orchestrion' ) ) {
You can’t perform that action at this time.
0 commit comments