Barry A. Warsaw <ba...@python.org> added the comment:

I like this a lot and while the issue is still open, I'm piggybacking my PR 
4240 on this one.

I have a use case for enabling this feature via environment variable, so PR 
4240 adds PYTHONPROFILEIMPORTTIME which also enables this feature.

We build our tools using pex, which hardcodes the shebang at the top of the zip 
file.  This isn't easily changed, and clearly we wouldn't want to enable -X 
importtime everywhere.  When we have startup performance issues, I want to be 
able to tell people (or set it up in our CI) to set the environment variable 
and collect the data for analysis.  This is much easier than tweaking the 
shebang or invoking the zip with an explicit command.  Also, there are 
potential gotchas with loading too much up on the shebang line (IIRC, there are 
line length limits and/or multiple option limits for shebangs, e.g. if we 
wanted to have both -I and -X).

I haven't fixed the initialization check problem that serhiy.storchaka points 
out, since that's addressed by PR 4138.  But maybe I should fold that change 
into mine.

----------
nosy: +barry
stage: patch review -> resolved

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31415>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to