From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.176.0/21 X-Spam-Status: No, score=-3.5 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MSGID_FROM_MTA_HEADER,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 From: Linus Torvalds Subject: Re: [RFC \ WISH] Add -o option to git-rev-list Date: Mon, 11 Dec 2006 08:59:01 -0800 (PST) Message-ID: References: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII NNTP-Posting-Date: Mon, 11 Dec 2006 17:01:04 +0000 (UTC) Cc: Git Mailing List , Junio C Hamano , Alex Riesen , Shawn Pearce Return-path: Envelope-to: gcvg-git@gmane.org In-Reply-To: X-MIMEDefang-Filter: osdl$Revision: 1.162 $ X-Scanned-By: MIMEDefang 2.36 Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: Received: from vger.kernel.org ([209.132.176.167]) by dough.gmane.org with esmtp (Exim 4.50) id 1GtoWM-0001ZH-UW for gcvg-git@gmane.org; Mon, 11 Dec 2006 18:00:55 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762933AbWLKQ7s (ORCPT ); Mon, 11 Dec 2006 11:59:48 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1762941AbWLKQ7s (ORCPT ); Mon, 11 Dec 2006 11:59:48 -0500 Received: from smtp.osdl.org ([65.172.181.25]:44064 "EHLO smtp.osdl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762933AbWLKQ7q (ORCPT ); Mon, 11 Dec 2006 11:59:46 -0500 Received: from shell0.pdx.osdl.net (fw.osdl.org [65.172.181.6]) by smtp.osdl.org (8.12.8/8.12.8) with ESMTP id kBBGx3ID021406 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Mon, 11 Dec 2006 08:59:38 -0800 Received: from localhost (shell0.pdx.osdl.net [10.9.0.31]) by shell0.pdx.osdl.net (8.13.1/8.11.6) with ESMTP id kBBGx1J1031913; Mon, 11 Dec 2006 08:59:02 -0800 To: Marco Costalba Sender: git-owner@vger.kernel.org On Mon, 11 Dec 2006, Marco Costalba wrote: > > These are tipical values (warm cache): > > $ time git rev-list --header --boundary --parents --topo-order HEAD | cat > /dev/null > 3.67user 0.36system 0:04.29elapsed 93%CPU (0avgtext+0avgdata 0maxresident)k > 0inputs+0outputs (0major+18033minor)pagefaults 0swaps That's not timing what I asked. That's just timing the "git-rev-list". You need to time the "cat" part too. Either use a script, or do something like time sh -c "git-rev-list ... | cat > /dev/null". > $ time git rev-list --header --boundary --parents --topo-order HEAD > > /tmp/tmp.txt; cat /tmp/tmp.txt > /dev/null > 3.44user 0.28system 0:03.74elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k > 0inputs+0outputs (0major+18033minor)pagefaults 0swaps Again - you're only timing the _writer_, not the "cat" at all. > For some reason the CPU *never* goes up 93% with pipe (while it's easy > in the other two cases) That's because you're only timing 93% of the work (ignoring the "cat" part), and in the other cases you're ignoring the "cat" (that happens _afterwards_, not concurrently) entirely. > OK. I just don't understand how after waiting 100ms I get only 60KB > and stay in the loop only one cycle instead of reading, That's because the _writer_ will block. It notices that the reader cannot read ass fast as it can write, so it blocks when its buffers fill up. If you want to be fast, you need to be fast at reading. It's that simple.