Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'function:': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'def': 0.12; "wouldn't": 0.14; 'windows': 0.15; 'caches': 0.16; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; 'no-op': 0.16; 'subtract': 0.16; 'subject:python': 0.16; 'sender:addr:gmail.com': 0.17; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'certainly': 0.24; 'skip': 0.24; 'cc:2**0': 0.24; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'subject:) ': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'overhead': 0.31; 'file': 0.32; 'probably': 0.32; 'subject:time': 0.33; 'actual': 0.34; 'subject: (': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'doing': 0.36; 'how': 0.40; 'first': 0.61; 'to:addr:gmail.com': 0.65; 'subject:get': 0.81 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=PuK+G6oS/l7Mnd0gUCqEObkpCdtf3QU8KpAduq01w/g=; b=wEhr+V7N6u/MwO1z/p+fF8FDL3SeUg2wn2fMOpg8QU5AVjL9+kCR30FZBbBhl9H9B9 drmAda+BAqgrkXWH0jv7O50MpIfcW9HQiV4JPDA3EB6+AUmiu1kIrDO1HdObLSlULgdw lyOPmXfPwZi6VX2PBESvr9Sq5m2OPPtwWYJYgRbu1MtK0VZjzSK4plIO/l8WJ9mUSVwy fg93z97TWuUXLBLW3omEEA6cgJ/QWc+KiNzixqikx4vN8i/M4GKxZHenesl08d5eb4OP hfjzz84XzYuAYMF/WfwdmqOpl/8kvP5AnieDZyxs0DldXIjxi8g1hprajCR9Qr6klaXN 8OYg== MIME-Version: 1.0 X-Received: by 10.50.9.37 with SMTP id w5mr4579599iga.29.1379242353507; Sun, 15 Sep 2013 03:52:33 -0700 (PDT) Sender: skip.montanaro@gmail.com In-Reply-To: <8baf5318-f82c-417d-9a1d-956bf9cb3856@googlegroups.com> References: <8baf5318-f82c-417d-9a1d-956bf9cb3856@googlegroups.com> Date: Sun, 15 Sep 2013 05:52:33 -0500 X-Google-Sender-Auth: mUuF977Bzfv1Bi7HkskDhfbEdNk Subject: Re: How to get time (milisecond) of a python IO execution From: Skip Montanaro To: Tal Bar-Or Content-Type: text/plain; charset=UTF-8 Cc: Python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1379242355 news.xs4all.nl 15972 [2001:888:2000:d::a6]:55576 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:54186 I'm not familiar with how Windows works, but I wouldn't be surprised if it caches directory information. (Unix systems certainly would.) You probably aren't really doing much actual I/O to get the size of a file after the first run. Also, you probably want to subtract the time it takes to execute a no-op function: def noop(): pass to eliminate the overhead of calling your main function. Skip