Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #70545

Re: object().__dict__

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <pconnell@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.107
X-Spam-Level *
X-Spam-Evidence '*H*': 0.80; '*S*': 0.01; 'cpython': 0.05; 'true,': 0.05; 'amounts': 0.07; 'attribute': 0.07; 'dev': 0.07; 'pypy': 0.07; 'attributes': 0.09; 'url:pypy': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'mostly': 0.14; '23,': 0.16; 'larger,': 0.16; 'pypy.': 0.16; 'simpson': 0.16; 'subject:object': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'memory': 0.22; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'cc:2**0': 0.24; 'class.': 0.26; 'header:In-Reply-To:1': 0.27; 'fixed': 0.29; 'code': 0.31; 'consumption': 0.31; 'probably': 0.32; 'url:python': 0.33; 'used,': 0.33; 'comment': 0.34; 'core': 0.34; "i'd": 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; '+0200,': 0.36; 'idle': 0.36; 'object,': 0.36; 'var': 0.36; 'charset:us-ascii': 0.36; 'similar': 0.36; 'url:org': 0.36; 'being': 0.38; 'does': 0.39; 'use.': 0.39; 'how': 0.40; 'even': 0.60; 'access,': 0.60; 'increased': 0.61; 'url:3': 0.61; 'received:173': 0.61; 'back': 0.62; 'save': 0.62; 'content- disposition:inline': 0.62; "you'll": 0.62; 'more': 0.64; 'url:blogspot': 0.65; 'to:addr:gmail.com': 0.65; 'url:11': 0.68; 'price': 0.69; 'increase': 0.74; 'analysis': 0.75; 'absolutely.': 0.84; 'footprint': 0.84; 'or...': 0.84; 'phil': 0.84; 'speculation': 0.84; 'url:tech': 0.84; 'ratio': 0.91; 'url:latest': 0.91; 'balances': 0.93; 'hand,': 0.93; 'imagine': 0.93; 'url:fr': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=lJn+sDOcn8yiXmJKUEgtHDMWG3hyVBMNTwFQFL+Uj10=; b=IIBZYsKJSMIel1rLoce9WqZ5tEiCRg+yYVqaO5zznlDpnuQ1OsNVHfpi5NwmGiWDDp 0O4SWFymSm7zQZ9t3KBh6rsEqT9ovk8Cjtb0c1TvZr/LKX+wpOO5y2+ib3e3/PFWA4Q0 glNcINxTHR7+18F5kzOXAwX3xJ6sStPYrNm8jTKNY+TnG0ctoyF1I3EJ5aODRZazCDPa kIZT3NN9XrbGIjbo0ppZamxZTjttPZndNxQN6C2gurkJG/i4p0mYRmfnZ8Fr9NVTEgRY K+3kbjO8eiIsm9k+0KHrGKg3s0RU/yBzKt4i6/tZoYm4WEFf+wqfVmVhLfMe+xQ9XGPQ KHAw==
X-Received by 10.180.185.100 with SMTP id fb4mr2399929wic.11.1398268250511; Wed, 23 Apr 2014 08:50:50 -0700 (PDT)
Date Wed, 23 Apr 2014 16:50:47 +0100
From Phil Connell <pconnell@gmail.com>
To Amirouche Boubekki <amirouche.boubekki@gmail.com>
Subject Re: object().__dict__
References <51d9b7f1-3511-4110-adb2-aa2226bd7a3c@lists.xtsubasa.org> <20140423061123.GA47008@cskk.homeip.net> <CAL7_Mo9Hb44ZPEw2UvKcRDiugw-Voh0y=JoMHqGKYHzY8dyKrA@mail.gmail.com> <20140423135935.GA17819@phconnel-ws.cisco.com> <CAL7_Mo_PTrCW=GYP5AWJ+OnpCgrzZ0p7QUJGRXginNxzCscH1w@mail.gmail.com>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <CAL7_Mo_PTrCW=GYP5AWJ+OnpCgrzZ0p7QUJGRXginNxzCscH1w@mail.gmail.com>
User-Agent Mutt/1.5.23 (2014-03-12)
Cc python-list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9468.1398268738.18130.python-list@python.org> (permalink)
Lines 54
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1398268738 news.xs4all.nl 2877 [2001:888:2000:d::a6]:51041
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:70545

Show key headers only | View raw


On Wed, Apr 23, 2014 at 04:21:26PM +0200, Amirouche Boubekki wrote:
> 2014-04-23 15:59 GMT+02:00 Phil Connell <pconnell@gmail.com>:
> 
> > On Wed, Apr 23, 2014 at 03:48:32PM +0200, Amirouche Boubekki wrote:
> > > 2014-04-23 8:11 GMT+02:00 Cameron Simpson <cs@zip.com.au>:
> > > > Look up the "__slots__" dunder var in the Python doco index:
> > > >
> > > >   https://docs.python.org/3/glossary.html#term-slots
> > > >
> > > > You'll see it as a (rarely used, mostly discouraged) way to force a
> > fixed
> > > > set of attributes onto a class. As with object, this brings a smaller
> > > > memory footprint and faster attribute access, but the price is
> > flexibility.
> > > >
> > >
> > > True, still can be the only way to save few MB or... GB without falling
> > > back to C or PyPy.
> > >
> > > Have a look at PyPy to how to save memory (and speed things up) without
> > > slots:
> > >
> > http://morepypy.blogspot.fr/2010/11/efficiently-implementing-python-objects.html
> >
> > Is there any analysis of how this balances increased memory usage from the
> > JIT
> > vs the CPython VM (with a reasonable amount of code)?
> >
> > I'd thought that one of the main disadvantages of PyPy was drastically
> > increased memory usage for any decent-sized program. Would be interested to
> > know if this was not the case :)
> >
> 
> I have a similar thought, I don't how that memory consumption increase (a
> constant? a factor? probably both...)
> 
> but if the program use an absurd amount of memory even in CPython then PyPy
> will be able to catchup based on comment #1 of a PyPy core dev in
> http://tech.oyster.com/save-ram-with-python-slots/ see also
> http://pypy.readthedocs.org/en/latest/interpreter-optimizations.html#dictionary-optimizations

Absolutely. For long-running code manipulating large amounts of data I can
imagine the PyPy optimisations being a win.

On the other hand, if the code/data ratio is larger, CPython may well win in
terms of memory use.


> 
> Still it requires more analysis. When does PyPy trigger the optimization?

Indeed. Without measuring this is all idle speculation ;)

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: object().__dict__ Phil Connell <pconnell@gmail.com> - 2014-04-23 16:50 +0100

csiph-web