From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id DC1E02C39 for ; Fri, 14 Jul 2017 17:39:41 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 88EC820C46; Fri, 14 Jul 2017 11:39:40 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Fri, 14 Jul 2017 11:39:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=4OJGxaRXOEjzyTQ gxxKa8TZ2Q+8jYsmLSMJeJP76N2Y=; b=M0JgdW7BuNrxG3ao8r021/Sjuu2qpr2 l3SBh+Mbj7/Dw7zwZ62VnU2UAzoTrMoYRr/OfdI5LuM1dVrchrxGBS9HQgP65Ia/ KoN8W231lVM6UOioUZLhQOeOwEdK0Z1r7yenXR92dAlBaw+t99M7FjRNRNj9M+6l t0G76ouHzLYI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=4OJGxaRXOEjzyTQgxxKa8TZ2Q+8jYsmLSMJeJP76N2Y=; b=fAG6k+iq 2RB4b8sOVfzHkgvATswgKs/8Mbv7etIY1E4a0vY2bDy2BbsT56UsBWDPQ5yEB/kE uTmpB38Av9OcNwbQ78iYeS54yPupBd+vA3ZHAb8Q5uHBS9y8a78VGjThF7fDk8rJ gR42/rBs8vahOIqHQxiZ6IgzjWqhIF+ynjaesOFm5ydPOeWtfogoHpTG4V0rsi0V NumP1wXg1/eV2eGLt81o4LWwGcR9ZTTq/DcRQROU5QQPV33Lv+Gi2J1BFd/lUuj/ h6vt48WN+qkdafAAqTCA98ppc1LL4j5sfOhIbPI3ZU5wHNqKPVjk60Wwkuh3jP2p dF+4gB/83J+0fA== X-ME-Sender: X-Sasl-enc: Vy+LCo0ECpWvqABPBcdc7yjgeEl+c0R90LisKP6FeO/b 1500046780 Received: from xps.localnet (182.20.90.92.rev.sfr.net [92.90.20.182]) by mail.messagingengine.com (Postfix) with ESMTPA id 2129B2424F; Fri, 14 Jul 2017 11:39:40 -0400 (EDT) From: Thomas Monjalon To: Stephen Hemminger Cc: dev@dpdk.org Date: Fri, 14 Jul 2017 17:39:33 +0200 Message-ID: <12511927.qublii9NrP@xps> In-Reply-To: <7177425.p9cP4Rfg1a@xps> References: <20170711185546.26138-1-stephen@networkplumber.org> <20170712145925.2dfe5be1@xeon-e3> <7177425.p9cP4Rfg1a@xps> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH 01/19] devtools: add simple script to find duplicate includes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Jul 2017 15:39:42 -0000 13/07/2017 08:56, Thomas Monjalon: > 12/07/2017 23:59, Stephen Hemminger: > > On Tue, 11 Jul 2017 22:33:55 +0200 > > Thomas Monjalon wrote: > > > > > Thank you for this script, but... it is written in Perl! > > > I don't think it is a good idea to add yet another language to DPDK. > > > We already have shell and python scripts. > > > And I am not sure a lot of (young) people are able to parse it ;) > > > > > > I would like to propose this shell script: [...] > > > plus shell is 7x slower. > > > > $ time bash -c "find . -name '*.c' | xargs /tmp/dupinc.sh" > > real 0m0.765s > > user 0m1.220s > > sys 0m0.155s > > $time bash -c "find . -name '*.c' | xargs ~/bin/dup_inc.pl" > > real 0m0.131s > > user 0m0.118s > > sys 0m0.014s > > I don't think speed is really relevant here :) I did my own benchmark (recreation time): # time sh -c 'for file in $(git ls-files app buildtools drivers examples lib test) ; do devtools/dup_include.pl $file ; done' 4,41s user 1,32s system 101% cpu 5,667 total # time devtools/check-duplicate-includes.sh 5,48s user 1,00s system 153% cpu 4,222 total The shell version is reported as faster on my computer! It is faster when filtering only .c and .h files: for file in $(git ls-files '*.[ch]') ; do dups=$(sed -rn "s,$pattern,\1,p" $file | sort | uniq -d) [ -z "$dups" ] || echo "$dups" | sed "s,^,$file: duplicated include: ," done # time sh -c 'for file in $(git ls-files "*.[ch]") ; do devtools/dup_include.pl $file ; done' 3,65s user 1,05s system 100% cpu 4,668 total # time devtools/check-duplicate-includes.sh 4,72s user 0,80s system 153% cpu 3,603 total I prefer this version using only pipes, which is well parallelized: for file in $(git ls-files '*.[ch]') ; do sed -rn "s,$pattern,\1,p" $file | sort | uniq -d | sed "s,^,$file: duplicated include: ," done 7,40s user 1,49s system 231% cpu 3,847 total