js:锄地一条龙1.3.5和新js"性能测试" (#1497)

This commit is contained in:
mno
2025-08-07 13:21:18 +08:00
committed by GitHub
parent 5b240ba7c5
commit 809039b2af
7 changed files with 82 additions and 6 deletions

View File

@@ -0,0 +1,29 @@
// 主函数
(async function () {
let startTime = Date.now();
const interval = +settings.interval || 1000;
const timeout = +settings.timeout || 60;
let lastCheck = startTime;
let ocrcount = 0;
let loopCount = 0;
let logCount = 0;
//let store = [];
while (Date.now() - startTime < timeout * 1000) {
loopCount++;
try {
let GameRegion = captureGameRegion();
// store[loopCount] = GameRegion;
if (settings.dispose) GameRegion.dispose();
ocrcount++;
} catch (error) {
log.error(`运行时发生异常: ${error.message}`);
break;
}
if (Date.now() - lastCheck >= interval) {
logCount++;
lastCheck = Date.now();
log.info(`在第${logCount}${interval}毫秒内执行了${ocrcount}次截图`);
ocrcount = 0;
}
}
})();