From c1f7cccfdc8d07873804c8128d58721f002bacb0 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 09 May 2013 11:29:28 -0400 Subject: Makefile.in: Replace old sed cmds with basename. The result is the same, and basename is a bit faster than sed is. A quick and dirty benchmark: printf 'printf and sed:\n' i=0 while [ ${i} -lt 3 ]; do time -p sh >/dev/null <<-EOF i=0 while [ \${i} -lt 1000 ]; do printf '%s' 'foo/bar' | sed 's|^.*/||' i=\$((\$i + 1)) done EOF i=$(($i + 1)) done printf '\nbasename:\n' i=0 while [ ${i} -lt 3 ]; do time -p sh >/dev/null <<-EOF i=0 while [ \${i} -lt 1000 ]; do basename 'foo/bar' i=\$((\$i + 1)) done EOF i=$(($i + 1)) done And the unsurprising results: printf and sed: real 1.17 user 0.02 sys 0.17 real 1.18 user 0.01 sys 0.18 real 1.17 user 0.02 sys 0.16 basename: real 0.74 user 0.02 sys 0.08 real 0.74 user 0.02 sys 0.08 real 0.72 user 0.04 sys 0.06 basename is about 37% – 38% faster. --- (limited to 'tests') -- cgit v0.9.1