[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bash-bug
Subject:    Re: Bad performance for substring replacement by pattern
From:       Linda Walsh <bash () tlinx ! org>
Date:       2010-07-18 18:57:50
Message-ID: 4C434EAE.4050001 () tlinx ! org
[Download RAW message or body]



Yi Yan wrote:
> Hi,
> 
>      I used the following Bash script to test substring replacement operator.
> It is performance get worse very quickly with the increasing of the string
> length.
> 
>     I test the script with Bash(4.1) on Debian Linux machine.
> 
>     See the execution time difference by increasing the $NUM in the script:
> 
> 
> ========================================
> #! /usr/local/bin/bash
> 
> declare z="start"
> declare NUM=1000
> 
> #----------------------------------
> # create a long string with ';'
> #----------------------------------
> for ((i=0; i<$NUM; i++)); do
>     z="$z;string$i"
> done
> 
> 
> #------------------------------
> # delete everything except ';'
> #------------------------------
> date +%s
> 
> x="${z//[^;]}"
> echo $x
> 
> date +%s
> 
> 
>  		 	   		  
> _________________________________________________________________
> The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
----
	So you did the above and what did you find out?

	(Or did I miss an email?)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic