Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed6.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.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'context': 0.05; 'memory.': 0.05; 'processing.': 0.07; 'sized': 0.07; 'accuracy.': 0.09; 'url:activestate': 0.09; 'suggest': 0.11; ':-)': 0.13; 'blocks': 0.16; 'oct': 0.16; 'two.': 0.16; 'wrote:': 0.17; 'variables': 0.17; '>>>': 0.18; 'memory': 0.18; 'to:name:python- list@python.org': 0.20; 'finally,': 0.22; 'hours,': 0.22; "i'd": 0.22; 'example': 0.23; "i've": 0.23; 'external': 0.24; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '---': 0.26; 'charset:iso-8859-15': 0.26; 'fit': 0.26; 'am,': 0.27; 'question': 0.27; 'have,': 0.27; "doesn't": 0.28; 'correct': 0.28; "d'aprano": 0.29; 'steven': 0.29; 'surprised': 0.29; 'case,': 0.29; 'url:code': 0.29; 'code': 0.31; 'file': 0.32; 'could': 0.32; 'ram': 0.33; 'to:addr:python-list': 0.33; 'likely': 0.33; 'wrong': 0.34; 'thanks': 0.34; 'list': 0.35; 'there': 0.35; 'tool': 0.36; 'but': 0.36; 'alone': 0.36; 'subject: (': 0.36; 'two': 0.37; 'being': 0.37; 'why': 0.37; 'rather': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'subject:-': 0.40; 'your': 0.60; 'link': 0.60; 'matter': 0.61; 'times': 0.63; 'more': 0.63; 'reviewed': 0.74; '100': 0.78; 'gain': 0.79; 'more:': 0.84; 'received:213.150': 0.84; 'subject:Fast': 0.84; 'subject:read': 0.84; 'subject:write': 0.84; 'timings': 0.84; 'average': 0.93 X-SENDER-IP: [213.112.50.224] X-LISTENER: [smtp.bredband.net] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnocAFiVh1DVcDLgPGdsb2JhbAANN8IUAQEBATiCUgEBAQEDODQKEwsYCSUPAjIUBg0GAgEBiAunQJNFi2CGawOXCpIT X-IronPort-AV: E=Sophos;i="4.80,639,1344204000"; d="scan'208";a="432639174" Date: Wed, 24 Oct 2012 09:19:36 +0200 From: Virgil Stokes User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: "python-list@python.org" Subject: Re: Fast forward-backward (write-read) References: <5086AA35.4000509@it.uu.se> <50871ff6$0$29978$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <50871ff6$0$29978$c3e8da3$5496439d@news.astraweb.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit 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: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351063172 news.xs4all.nl 6844 [2001:888:2000:d::a6]:55068 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32012 On 24-Oct-2012 00:53, Steven D'Aprano wrote: > On Tue, 23 Oct 2012 17:50:55 -0400, David Hutto wrote: > >> On Tue, Oct 23, 2012 at 10:31 AM, Virgil Stokes wrote: >>> I am working with some rather large data files (>100GB) > [...] >>> Finally, to my question --- What is a fast way to write these variables >>> to an external file and then read them in backwards? >> Don't forget to use timeit for an average OS utilization. > Given that the data files are larger than 100 gigabytes, the time > required to process each file is likely to be in hours, not microseconds. > That being the case, timeit is the wrong tool for the job, it is > optimized for timings tiny code snippets. You could use it, of course, > but the added inconvenience doesn't gain you any added accuracy. > > Here's a neat context manager that makes timing long-running code simple: > > > http://code.activestate.com/recipes/577896 Thanks for this link > > > >> I'd suggest two list comprehensions for now, until I've reviewed it some >> more: > I would be very surprised if the poster will be able to fit 100 gigabytes > of data into even a single list comprehension, let alone two. You are correct and I have been looking at working with blocks that are sized to the RAM available for processing. > > This is a classic example of why the old external processing algorithms > of the 1960s and 70s will never be obsolete. No matter how much memory > you have, there will always be times when you want to process more data > than you can fit into memory. > > > Thanks for your insights :-)