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


Groups > comp.lang.python > #70544 > unrolled thread

Re: object().__dict__

Started byAmirouche Boubekki <amirouche.boubekki@gmail.com>
First post2014-04-23 16:21 +0200
Last post2014-04-23 13:25 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: object().__dict__ Amirouche Boubekki <amirouche.boubekki@gmail.com> - 2014-04-23 16:21 +0200
    Re: object().__dict__ CHIN Dihedral <dihedral88888@gmail.com> - 2014-04-23 13:25 -0700

#70544 — Re: object().__dict__

FromAmirouche Boubekki <amirouche.boubekki@gmail.com>
Date2014-04-23 16:21 +0200
SubjectRe: object().__dict__
Message-ID<mailman.9467.1398262908.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

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

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


>
>
> Cheers,
> Phil
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

[toc] | [next] | [standalone]


#70549

FromCHIN Dihedral <dihedral88888@gmail.com>
Date2014-04-23 13:25 -0700
Message-ID<d3a42a57-43ce-4b20-b514-d384dc23eba4@googlegroups.com>
In reply to#70544
On Wednesday, April 23, 2014 10:21:26 PM UTC+8, Amirouche Boubekki wrote:
> 2014-04-23 15:59 GMT+02:00 Phil Connell <pcon...@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 <c...@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
> 
> 
> 
> 
> Still it requires more analysis. When does PyPy trigger the optimization?
> 
>  
> 
> 
> 
> 
> 
> 
> Cheers,
> 
> Phil
> 
> 
> 
> --
> 
> https://mail.python.org/mailman/listinfo/python-list

 The auto-code generation  of valid python codes in PyPy is helpful in CAD/CAM and non-idiot robot brains.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web