1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 20:50:06 +00:00

Performance and speed optimization

This commit is contained in:
Tw93
2025-12-08 15:34:51 +08:00
parent ea8488c1bb
commit 78e6743666
13 changed files with 366 additions and 552 deletions

View File

@@ -69,7 +69,7 @@ TOTAL_CHECKS=0
# Check 1: Keyboard input handling (restored to 1s for reliability)
((TOTAL_CHECKS++))
if grep -q "read -r -s -n 1 -t 1" lib/core/common.sh; then
if grep -q "read -r -s -n 1 -t 1" lib/core/ui.sh; then
echo -e "${GREEN} ✓ Keyboard timeout properly configured (1s)${NC}"
((OPTIMIZATION_SCORE++))
else
@@ -78,7 +78,8 @@ fi
# Check 2: Single-pass drain_pending_input
((TOTAL_CHECKS++))
DRAIN_PASSES=$(grep -c "while IFS= read -r -s -n 1" lib/core/common.sh || echo 0)
DRAIN_PASSES=$(grep -c "while IFS= read -r -s -n 1" lib/core/ui.sh 2> /dev/null || true)
DRAIN_PASSES=${DRAIN_PASSES:-0}
if [[ $DRAIN_PASSES -eq 1 ]]; then
echo -e "${GREEN} ✓ drain_pending_input optimized (single-pass)${NC}"
((OPTIMIZATION_SCORE++))
@@ -88,7 +89,7 @@ fi
# Check 3: Log rotation once per session
((TOTAL_CHECKS++))
if grep -q "rotate_log_once" lib/core/common.sh && ! grep "rotate_log()" lib/core/common.sh | grep -v "rotate_log_once" > /dev/null 2>&1; then
if grep -q "rotate_log_once" lib/core/log.sh; then
echo -e "${GREEN} ✓ Log rotation optimized (once per session)${NC}"
((OPTIMIZATION_SCORE++))
else