Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jun 2015 19:02:30 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r284939 - stable/10/usr.sbin/freebsd-update
Message-ID:  <201506291902.t5TJ2UhE004536@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Mon Jun 29 19:02:30 2015
New Revision: 284939
URL: https://svnweb.freebsd.org/changeset/base/284939

Log:
  MFC r256594 (cperciva):
  
  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:
  stable/10/usr.sbin/freebsd-update/freebsd-update.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/freebsd-update/freebsd-update.sh
==============================================================================
--- stable/10/usr.sbin/freebsd-update/freebsd-update.sh	Mon Jun 29 18:56:53 2015	(r284938)
+++ stable/10/usr.sbin/freebsd-update/freebsd-update.sh	Mon Jun 29 19:02:30 2015	(r284939)
@@ -3099,21 +3099,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 "



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506291902.t5TJ2UhE004536>