From 53876580cb7e69075fd8ac8de1b59e39257c5d86 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 10:15:41 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Improve=20bash=20loop=20per?= =?UTF-8?q?formance=20with=20glob=20matching?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: WHYCRASH <6760226+WHYCRASH@users.noreply.github.com> --- vpn-auto.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vpn-auto.sh b/vpn-auto.sh index b8c1dc2..047712c 100755 --- a/vpn-auto.sh +++ b/vpn-auto.sh @@ -83,15 +83,17 @@ if [ -n "$US_SERVERS" ]; then state="${server#US-}" state="${state%%#*}" + # ⚡ Bolt: Replaced regex evaluation (=~) with native bash glob matching. + # Impact: Avoids regex compilation overhead in a tight loop, speeding up server filtering. # Check against exclusions - if [[ "$state" =~ ^($EXCLUDED_STATES)$ ]]; then + if [[ "|$EXCLUDED_STATES|" == *"|$state|"* ]]; then continue fi FILTERED_SERVERS+=("$server") # Check against favorites - if [[ "$state" =~ ^($FAVORED_STATES)$ ]]; then + if [[ "|$FAVORED_STATES|" == *"|$state|"* ]]; then FAVORED_SERVERS+=("$server") fi done