On 9/18/16 5:32 AM, xa...@t-online.de wrote:

> Bash Version: 4.4
> Patch Level: 0
> Release Status: rc2 / release
> 
> Description:
>       The tests below were performed with 4.4.0-rc2. However, the problem is
>       still present in 4.4.0-release, only execution times are even higher
>       for about 20%.
> 
>       Repeated pattern substitution (here: removal) using an extended pattern
>       and variables of considerable size is incredibly time and cpu consuming.
>       The command that revealed the problem was:
> 
>                D=${C//\[+([0-9])\]=}

This is absolutely true.  The extended pattern matching code is very slow
and does far more work, in the sense that the matcher traverses the string
to be matched, than it needs to.  It's never been optimized, and the
primitives are not quite suited for this kind of scenario: multiple
short matches in a long string.

This is one of the things on my list to look at for bash-5.0.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to