Re: [Python-Dev] To reduce Python "application" startup time

2017-09-23 Thread Serhiy Storchaka
05.09.17 16:02, INADA Naoki пише: While I can't attend to sprint, I saw etherpad and I found Neil Schemenauer and Eric Snow will work on startup time. I want to share my current knowledge about startup time. For bare (e.g. `python -c pass`) startup time, I'm waiting C implementation of ABC.

Re: [Python-Dev] To reduce Python "application" startup time

2017-09-20 Thread Brett Cannon
I should mention that I have a prototype design for improving importlib's lazy loading to be easier to turn on and use. See https://notebooks.azure.com/Brett/libraries/di2Btqj7zSI/html/Lazy%20importing.ipynb for my current notes. Part of it includes an explicit lazy_import() function which would

Re: [Python-Dev] To reduce Python "application" startup time

2017-09-06 Thread Neil Schemenauer
INADA Naoki wrote: > Current `python -v` is not useful to optimize import. > So I use this patch to profile import time. > https://gist.github.com/methane/e688bb31a23bcc437defcea4b815b1eb I have implemented DTrace probes that do almost the same thing. Your patch is better

Re: [Python-Dev] To reduce Python "application" startup time

2017-09-06 Thread INADA Naoki
> I’m not sure however whether burying imports inside functions (as a kind of > poor man’s lazy import) is ultimately going to be satisfying. First, it’s > not natural, it generally violates coding standards (e.g. PEP 8), and can > make linters complain. Of course, I tried to move imports

Re: [Python-Dev] To reduce Python "application" startup time

2017-09-06 Thread Barry Warsaw
On Sep 6, 2017, at 00:42, INADA Naoki wrote: > Additionally, faster startup time (and smaller memory footprint) is good > for even Web applications. > For example, CGI is still comfortable tool sometimes. > Another example is GAE/Python. > > Anyway, I think researching

Re: [Python-Dev] To reduce Python "application" startup time

2017-09-06 Thread Chris Barker - NOAA Federal
> Anyway, I think researching import tree of popular library is good > startline > about optimizing startup time. > I agree -- in this case, you've identified that asyncio is expensive -- good to know. In the jinja2 case, does it always need asyncio? Pep8 as side, I think it often makes sense

Re: [Python-Dev] To reduce Python "application" startup time

2017-09-06 Thread Wes Turner
On Wednesday, September 6, 2017, INADA Naoki wrote: > > How significant is application startup time to something that uses > > Jinja2? Are there short-lived programs that use it? Python startup > > time matters enormously to command-line tools like Mercurial, but far > >

Re: [Python-Dev] To reduce Python "application" startup time

2017-09-06 Thread INADA Naoki
> How significant is application startup time to something that uses > Jinja2? Are there short-lived programs that use it? Python startup > time matters enormously to command-line tools like Mercurial, but far > less to something that's designed to start up and then keep running > (eg a web app,

Re: [Python-Dev] To reduce Python "application" startup time

2017-09-05 Thread Chris Angelico
On Wed, Sep 6, 2017 at 2:30 PM, INADA Naoki wrote: >>> This patch moves a few imports inside functions. I wonder whether that kind >>> of change actually helps with real applications—doesn't any real application >>> end up importing the socket module anyway at some point?

Re: [Python-Dev] To reduce Python "application" startup time

2017-09-05 Thread INADA Naoki
>> This patch moves a few imports inside functions. I wonder whether that kind >> of change actually helps with real applications—doesn't any real application >> end up importing the socket module anyway at some point? > > I don't know if this particular change is worthwhile, but one place > where

Re: [Python-Dev] To reduce Python "application" startup time

2017-09-05 Thread INADA Naoki
>> With this profile, I tried optimize `python -c 'import asyncio'`, logging >> and http.client. >> >> >> https://gist.github.com/methane/1ab97181e74a33592314c7619bf34233#file-0-optimize-import-patch >> > This patch moves a few imports inside functions. I wonder whether that kind > of change

Re: [Python-Dev] To reduce Python "application" startup time

2017-09-05 Thread INADA Naoki
>> >> I haven't created pull request yet. >> (Can I create without issue, as trivial patch?) > > > Trivial, no-issue PRs are meant for things like typo fixes that need no > discussion or record. > > Moving imports in violation of the PEP 8 rule, "Imports are always put at > the top of the file,

Re: [Python-Dev] To reduce Python "application" startup time

2017-09-05 Thread Nathaniel Smith
On Tue, Sep 5, 2017 at 11:13 AM, Jelle Zijlstra wrote: > > > 2017-09-05 6:02 GMT-07:00 INADA Naoki : >> With this profile, I tried optimize `python -c 'import asyncio'`, logging >> and http.client. >> >> >>

Re: [Python-Dev] To reduce Python "application" startup time

2017-09-05 Thread Jelle Zijlstra
2017-09-05 6:02 GMT-07:00 INADA Naoki : > Hi, > > While I can't attend to sprint, I saw etherpad and I found > Neil Schemenauer and Eric Snow will work on startup time. > > I want to share my current knowledge about startup time. > > For bare (e.g. `python -c pass`)

Re: [Python-Dev] To reduce Python "application" startup time

2017-09-05 Thread Terry Reedy
On 9/5/2017 9:02 AM, INADA Naoki wrote: But application startup time is more important. And we can improve them with optimize importing common stdlib. Current `python -v` is not useful to optimize import. So I use this patch to profile import time.

Re: [Python-Dev] To reduce Python "application" startup time

2017-09-05 Thread Ivan Levkivskyi
On 5 September 2017 at 15:02, INADA Naoki wrote: > Hi, > > [...] > > For bare (e.g. `python -c pass`) startup time, I'm waiting C > implementation of ABC. > Hi, I am not sure I will be able to finish it this week, also this depends on fixing interactions with ABC

[Python-Dev] To reduce Python "application" startup time

2017-09-05 Thread INADA Naoki
Hi, While I can't attend to sprint, I saw etherpad and I found Neil Schemenauer and Eric Snow will work on startup time. I want to share my current knowledge about startup time. For bare (e.g. `python -c pass`) startup time, I'm waiting C implementation of ABC. But application startup time is