Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #18462
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.erje.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 | <benoit.thiell.cfa@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python.': 0.04; 'memory.': 0.05; 'subject:Python': 0.05; 'python': 0.08; '[1]:': 0.09; '[2]:': 0.09; 'def': 0.13; '0.03': 0.16; '[4]:': 0.16; 'centos': 0.16; 'creation,': 0.16; 'did:': 0.16; 'explanation': 0.16; 'subject:memory': 0.16; 'test()': 0.16; 'test():': 0.16; 'received:74.125.82.44': 0.16; 'received:mail-ww0-f44.google.com': 0.16; 'memory': 0.21; 'subject:list': 0.21; 'sep': 0.23; 'sender:addr:gmail.com': 0.25; 'creating': 0.25; 'tests': 0.25; "i'm": 0.26; 'url:edu': 0.27; 'message-id:@mail.gmail.com': 0.28; 'problem': 0.29; 'ran': 0.30; 'tuples': 0.30; 'thanks': 0.31; 'time:': 0.32; 'total:': 0.32; 'list': 0.32; 'to:addr:python- list': 0.34; '2.4': 0.34; 'see,': 0.34; 'received:74.125.82': 0.35; 'solutions.': 0.37; 'machine': 0.37; 'received:74.125': 0.37; 'received:google.com': 0.37; 'to:addr:python.org': 0.40; 'your': 0.61; 'here': 0.65; 'million': 0.76; '9.15': 0.84; 'experiencing': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=O6RCu9lRrYbaapuwQftfbdmUqlFNO8CkTGwNO1nQ0qo=; b=rQ2OOAS25cNhMS4mxwXdw0em4ouC4PNCw2yXAM2nt2Wa5YTJskJt1m9oO6YKFDwcG3 QoRTvNHiLcgRReinJYdAm9fwkc4BHggkm3QqfDP8vpk60DB1/Q/iQemwviKqhgeLsyYn ZM4eKO2Bjpxy/6i/kfSeegDk2MIcvTDx1gcdQ= |
| MIME-Version | 1.0 |
| Sender | benoit.thiell.cfa@gmail.com |
| Date | Tue, 3 Jan 2012 17:38:11 -0500 |
| X-Google-Sender-Auth | 8EY2M1U3mYzBpu46Jn3FAQoIrO8 |
| Subject | Large list in memory slows Python |
| From | Benoit Thiell <bthiell@cfa.harvard.edu> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4391.1325630292.27778.python-list@python.org> (permalink) |
| Lines | 37 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1325630292 news.xs4all.nl 6900 [2001:888:2000:d::a6]:51773 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:18462 |
Show key headers only | View raw
Hi. I am experiencing a puzzling problem with both Python 2.4 and Python 2.6 on CentOS 5. I'm looking for an explanation of the problem and possible solutions. Here is what I did: Python 2.4.3 (#1, Sep 21 2011, 19:55:41) IPython 0.8.4 -- An enhanced Interactive Python. In [1]: def test(): ...: return [(i,) for i in range(10**6)] In [2]: %time x = test() CPU times: user 0.82 s, sys: 0.04 s, total: 0.86 s Wall time: 0.86 s In [4]: big_list = range(50 * 10**6) In [5]: %time y = test() CPU times: user 9.11 s, sys: 0.03 s, total: 9.14 s Wall time: 9.15 s As you can see, after creating a list of 50 million integers, creating the same list of 1 million tuples takes about 10 times longer than the first time. I ran these tests on a machine with 144GB of memory and it is not swapping. Before creating the big list of integers, IPython used 111MB of memory; After the creation, it used 1664MB of memory. Thanks for your time. Cheers. -- Benoit Thiell The SAO/NASA Astrophysics Data System http://adswww.harvard.edu/
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Large list in memory slows Python Benoit Thiell <bthiell@cfa.harvard.edu> - 2012-01-03 17:38 -0500
csiph-web