Re: [Python-Dev] Generator objects and list comprehensions?

2017-01-24 Thread Chris Angelico
On Wed, Jan 25, 2017 at 4:38 PM, Craig Rodrigues wrote: > > Glyph pointed this out to me here: > http://twistedmatrix.com/pipermail/twisted-python/2017-January/031106.html > > If I do this on Python 3.6: > >>> [(yield 1) for x in range(10)] > at 0x10cd210f8> > > If I

[Python-Dev] Generator objects and list comprehensions?

2017-01-24 Thread Craig Rodrigues
Hi, Glyph pointed this out to me here: http://twistedmatrix.com/pipermail/twisted-python/2017-January/031106.html If I do this on Python 3.6: >> [(yield 1) for x in range(10)] at 0x10cd210f8> If I understand this: https://docs.python.org/3/reference/expressions.html#list-displays then this

Re: [Python-Dev] Investigating Python memory footprint of one real Web application

2017-01-24 Thread Antoine Pitrou
On Tue, 24 Jan 2017 10:21:45 -0800 Nathaniel Smith wrote: > > The thing I found most surprising about that blog post was that contrary to > common wisdom, refcnt updates per se had essentially no effect on the > amount of memory shared between CoW processes, and the problems were

Re: [Python-Dev] Investigating Python memory footprint of one real Web application

2017-01-24 Thread Nathaniel Smith
On Jan 24, 2017 3:35 AM, "Thomas Wouters" wrote: On Fri, Jan 20, 2017 at 1:40 PM, Christian Heimes wrote: > On 2017-01-20 13:15, INADA Naoki wrote: > >> > >> "this script counts static memory usage. It doesn’t care about dynamic > >> memory usage of

Re: [Python-Dev] Investigating Python memory footprint of one real Web application

2017-01-24 Thread INADA Naoki
On Tue, Jan 24, 2017 at 11:08 PM, Victor Stinner wrote: > 2017-01-24 15:00 GMT+01:00 INADA Naoki : >> And here are top 3 tracebacks from tracemalloc: >> >> 15109615 (/180598) >> File "", line 488 >> File "", line 780 >> File "", line 675 >>

Re: [Python-Dev] Investigating Python memory footprint of one real Web application

2017-01-24 Thread Victor Stinner
2017-01-24 15:00 GMT+01:00 INADA Naoki : > And here are top 3 tracebacks from tracemalloc: > > 15109615 (/180598) > File "", line 488 > File "", line 780 > File "", line 675 > File "", line 655 FYI at Python startup, usually the largest memory block comes from the

Re: [Python-Dev] Investigating Python memory footprint of one real Web application

2017-01-24 Thread INADA Naoki
FWIW, I tried to skip compiler_visit_annotations() in Python/compile.c a) default: 41278060 b) remove annotations: 37140094 c) (b) + const merge: 35933436 (a-b)/a = 10% (a-c)/a = 13% And here are top 3 tracebacks from tracemalloc: 15109615 (/180598) File "", line 488 File

Re: [Python-Dev] Investigating Python memory footprint of one real Web application

2017-01-24 Thread INADA Naoki
> 3. I am -1 on ignoring annotations altogether. Sometimes they could be > helpful at runtime: typing.NamedTuple and mypy_extensions.TypedDict are two > examples. ignoring annotations doesn't mean ignoring typing at all. You can use typing.NamedTuple even when functions doesn't have

Re: [Python-Dev] Investigating Python memory footprint of one real Web application

2017-01-24 Thread Ivan Levkivskyi
1. It looks like there is still a room for performance improvement of typing w.r.t. how ABCs and issubclass() works. I will try to play with this soon. (the basic idea is that some steps could be avoided for parameterized generics). 2. I am +1 on having three separate options to independently

Re: [Python-Dev] Investigating Python memory footprint of one real Web application

2017-01-24 Thread Thomas Wouters
On Fri, Jan 20, 2017 at 1:40 PM, Christian Heimes wrote: > On 2017-01-20 13:15, INADA Naoki wrote: > >> > >> "this script counts static memory usage. It doesn’t care about dynamic > >> memory usage of processing real request" > >> > >> You may be trying to optimize