bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Very slow pattern substitution in parameter expansion


From: Dan Douglas
Subject: Re: Very slow pattern substitution in parameter expansion
Date: Tue, 09 Apr 2013 20:56:23 -0500
User-agent: KMail/4.8.3 (Linux/3.4.6-pf+; KDE/4.8.3; x86_64; ; )

Erm, here it is in a less unreadable format:

    #!/usr/bin/env bash
    typeset -a a=(
        curl --header 'Host: v33.veehd.com'
        --header 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) 
Gecko/20100101 Firefox/19.0'
        --header 'Accept: 
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
        --header 'Accept-Language: en-US,en;q=0.5'
        --header 'Accept-Encoding: gzip, deflate'
        --header 'Referer: 
http://veehd.com/vpi?h=NDcwNjgyNXw0ODB8ODQ2Ljh8ZGl2eHwzfDUwMDB8MTM2NTUzNzQ1OHwxNTJ8MXw0NTNmOTA3NDY1Yjg3ZmM5MjI0MTI$'
        --header 'Cookie: 
__utma=163375675.149191626.1365449922.1365465732.1365537650.4;__utmz=163375675.1365465732.3.2.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided);__utmb=163375675.1.10.1365537650;
 __utmc=163375675'
        --header 'Connection: keep-alive'
        
'http://v33.veehd.com/dl/45c2f8a516118e29917ff154fee0179e/1365544663/5000.4706825.avi&b=390'
        -o '4706825.avi'
        -L
    )

    time : "${a[*]//[0-9]/z}"
    time : "${a[*]//+([0-9])/z}"

I can't reproduce using the above code.

     $ bash ./testcases/substperf
    real    0m0.000s
    user    0m0.000s
    sys     0m0.000s

    real    0m0.000s
    user    0m0.000s
    sys     0m0.000s

As an aside, don't store commands in variables.
http://mywiki.wooledge.org/BashFAQ/050

-- 
Dan Douglas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]