mksh’s globbing really sucks. Way out: parse them as special kind of regex (NFA with making $KSH_MATCH an array, possibly).
References: - https://research.swtch.com/glob - https://swtch.com/~rsc/regexp/regexp1.html -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/625164 Title: some extended Korn shell globs are really slow Status in mksh: In Progress Bug description: Attaching a testcase. The first glob is decently fast, the second one is noticeable (about a second) on a 3 GHz Athlon. The third glob needs to be killed with SIGKILL out of all things. Also, I have another shell script, where replacing [[ $foo = *@(x)* ]] with [[ $foo = *'x'* ]] and [[ $foo = @(1|2………),* ]] with [[ $foo = 1,* || $foo = 2………,* ] made it noticeable faster. The probable culprit is gmatchx, do_gmatch, and friends, mostly from misc.c. This bug serves as documentation for now, because I have no idea how to tackle it, but if someone takes it up and submits patches, be my guest. To manage notifications about this bug go to: https://bugs.launchpad.net/mksh/+bug/625164/+subscriptions