ash: fix quadratic matching slowdown is ${v/*foo*/repl} (really bad one)
authorDenys Vlasenko <vda.linux@googlemail.com>
Sat, 13 Mar 2010 15:19:04 +0000 (16:19 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sat, 13 Mar 2010 15:19:04 +0000 (16:19 +0100)
commitb76356b28e9058fac1c9a50b274db8ce24273ca9
treeca594b49433d813415cc5edff30b001ef83ae9e4
parent6eaeb7737d95661ca31b162977ac443ffeb7b0b3
ash: fix quadratic matching slowdown is ${v/*foo*/repl} (really bad one)

It is especially bad with patterns starting with "*".

With ASH_OPTIMIZE_FOR_SIZE=y, only those are optimized, +few bytes:
   text    data     bss     dec     hex filename
 836337     441    7564  844342   ce236 busybox_old
 836341     441    7564  844346   ce23a busybox_unstripped

With ASH_OPTIMIZE_FOR_SIZE off, we also optimize patterns _ending_ with "*",
which costs about 80 bytes:
   text    data     bss     dec     hex filename
 836656     441    7564  844661   ce375 busybox_old
 836732     441    7564  844737   ce3c1 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c