Skip to content

Commit a5fe6da

Browse files
committed
change to create a PR
Force a perf regression Increase tests Fix reduce the overhead Reduce iterations Testing Restoring MAJOR_VERSION
1 parent d600452 commit a5fe6da

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

main.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,31 @@ class DummyRewriter {
2222

2323
let 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 = []
2536
class 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')) {

0 commit comments

Comments
 (0)