From owner-svn-src-all@FreeBSD.ORG Wed Oct 16 08:19:59 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 75F653A4; Wed, 16 Oct 2013 08:19:59 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 631CA29A8; Wed, 16 Oct 2013 08:19:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9G8JxXC068997; Wed, 16 Oct 2013 08:19:59 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9G8Jx8X068996; Wed, 16 Oct 2013 08:19:59 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201310160819.r9G8Jx8X068996@svn.freebsd.org> From: Colin Percival Date: Wed, 16 Oct 2013 08:19:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r256594 - head/usr.sbin/freebsd-update X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2013 08:19:59 -0000 Author: cperciva Date: Wed Oct 16 08:19:58 2013 New Revision: 256594 URL: http://svnweb.freebsd.org/changeset/base/256594 Log: Speed up `freebsd-update IDS` by using IFS to split fields instead of forking lots of processes to run echo|cut. In one test this reduced the CPU time from 980s to 134s and the wallclock time from 806s to 132s. Submitted by: Oleg Ginzburg Modified: head/usr.sbin/freebsd-update/freebsd-update.sh Modified: head/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- head/usr.sbin/freebsd-update/freebsd-update.sh Wed Oct 16 08:14:05 2013 (r256593) +++ head/usr.sbin/freebsd-update/freebsd-update.sh Wed Oct 16 08:19:58 2013 (r256594) @@ -3033,21 +3033,8 @@ IDS_compare () { mv INDEX-NOTMATCHING.tmp INDEX-NOTMATCHING # Go through the lines and print warnings. - while read LINE; do - FPATH=`echo "${LINE}" | cut -f 1 -d '|'` - TYPE=`echo "${LINE}" | cut -f 2 -d '|'` - OWNER=`echo "${LINE}" | cut -f 3 -d '|'` - GROUP=`echo "${LINE}" | cut -f 4 -d '|'` - PERM=`echo "${LINE}" | cut -f 5 -d '|'` - HASH=`echo "${LINE}" | cut -f 6 -d '|'` - LINK=`echo "${LINE}" | cut -f 7 -d '|'` - P_TYPE=`echo "${LINE}" | cut -f 8 -d '|'` - P_OWNER=`echo "${LINE}" | cut -f 9 -d '|'` - P_GROUP=`echo "${LINE}" | cut -f 10 -d '|'` - P_PERM=`echo "${LINE}" | cut -f 11 -d '|'` - P_HASH=`echo "${LINE}" | cut -f 12 -d '|'` - P_LINK=`echo "${LINE}" | cut -f 13 -d '|'` - + local IFS='|' + while read FPATH TYPE OWNER GROUP PERM HASH LINK P_TYPE P_OWNER P_GROUP P_PERM P_HASH P_LINK; do # Warn about different object types. if ! [ "${TYPE}" = "${P_TYPE}" ]; then echo -n "${FPATH} is a "