Configuration Information [Automatically generated, do not change]: Machine: i686 OS: linux-gnu Compiler: i686-pc-linux-gnu-gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linu x-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/ share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I ./lib -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/ sbin:/bin' -DSTANDARD_UTILS_PATH='/bin:/usr/bin:/sbin:/usr/sbin' -DSYS_BASHRC='/ etc/bash/bashrc' -DSYS_BASH_LOGOUT='/etc/bash/bash_logout' -DNON_INTERACTIVE_LOG IN_SHELLS -DSSH_SOURCE_BASHRC -march=athlon-xp -O2 -pipe -fomit-frame-pointer -g 3 uname output: Linux dragoda.com 2.6.28-gentoo-r2 #1 SMP Sat Feb 28 19:17:31 CET 2009 i686 AMD Sempron(tm) 3000+ AuthenticAMD GNU/Linux Machine Type: i686-pc-linux-gnu
Bash Version: 4.0 Patch Level: 10 Release Status: release Description: I have a bash script which reads about 250000 lines of xml code generating about 850 files with information extracted from the xml file. It uses the construct: while read line do case "$line" in .... done < file and this takes a little less than 2 minutes Trying to use mapfile I changed the above construct to: mapfile < file for i in "${mapfi...@]}" do line=$(echo $i) # strip leading blanks case "$line" in .... done With this change the job now takes more than 48 minutes. :( It may be that I am new to mapfiles, and there are more efficient ways to traverse a mapfile array, but if this the case please document it. Another suggestion for mapfile: please introduce an option to strip leading blanks so mapfile acts like readline so constructions like: line=$(echo $i) # strip leading blanks above can be avoid. -- Regards, Lennart Schultz