[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-dev
Subject:    Re: [Python-Dev] Request review of cProfile/profile series issue
From:       Wes Turner <wes.turner () gmail ! com>
Date:       2017-04-25 3:15:38
Message-ID: CACfEFw_yKGGkNmXNyJhuaoZzs05oJc=i-43_J8JJ-snzCvT7Aw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Sun, Apr 23, 2017 at 11:12 PM, Nick Coghlan <ncoghlan@gmail.com> wrote:

> On 23 April 2017 at 13:21, Louie Lu <me@louie.lu> wrote:
> > Hi all,
> >
> > I'm now looking for cProfile/profile lib's issue, and have solve a
> series of
> > dependent problem, here is the list:
> >
> > #9285 - Add a profile decorator to profile and cProfile
>

%prun -s
Src:
https://github.com/ipython/ipython/blob/master/IPython/core/magics/execution.py#L187
Docs:
https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-prun


http://pynash.org/2013/03/06/timing-and-profiling/
%time, %timeit
%prun, %lprun
%mprun, %memit


> > #30113 - Allow helper functions to wrap sys.setprofile
> > #18971 - Use argparse in the profile/cProfile modules
> > #30118 - Add unittest for cProfile/profile command line interface
> >
> > It can divide into two categories, first is the context manager problem,
> and
> > the second is optparse to argparse problem.
> >
> > 1. context manager problem:
> >
> > Relative issue: #9285, #30113
> > Relative PR: #287, #1212, #1253
> >
> > This is an issue since 2010, and stop at profile can't simply add a
> > __enter__ and __exit__ to make it a context manager. The main problem is,
> > sys.setprofile() will hit the return and get bad return in profile
> > dispatch_return function. The solution is to insert a simulate call in
> the
> > helper function, to provide the context between helper frame and where
> the
> > profile is defined.
>
> I'd like to second Louie's call for additional review here. I've been
> reviewing them so far, and they look sensible to me, but I don't
> personally know the profile code base at all,

so there's a strong
> chance I'll miss subtle details.
>

https://westurner.github.io/wiki/awesome-python-testing#benchmarks
- plop,



https://github.com/python/cpython/blob/master/Lib/profile.py
https://github.com/python/cpython/blob/master/Lib/cProfile.py

[Attachment #5 (text/html)]

<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr \
23, 2017 at 11:12 PM, Nick Coghlan <span dir="ltr">&lt;<a \
href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span \
class="gmail-">On 23 April 2017 at 13:21, Louie Lu &lt;<a \
href="mailto:me@louie.lu">me@louie.lu</a>&gt; wrote:<br> &gt; Hi all,<br>
&gt;<br>
&gt; I&#39;m now looking for cProfile/profile lib&#39;s issue, and have solve a \
series of<br> &gt; dependent problem, here is the list:<br>
&gt;<br>
&gt; #9285 - Add a profile decorator to profile and \
cProfile<br></span></blockquote><div><br></div><div>%prun -s</div><div>Src:  <a \
href="https://github.com/ipython/ipython/blob/master/IPython/core/magics/execution.py# \
L187">https://github.com/ipython/ipython/blob/master/IPython/core/magics/execution.py#L187</a></div><div>Docs: \
<a href="https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-prun"> \
https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-prun</a></div><div><br></div><div><br></div><div><a \
href="http://pynash.org/2013/03/06/timing-and-profiling/">http://pynash.org/2013/03/06/timing-and-profiling/</a><br></div><div>%time, \
%timeit</div><div>%prun, %lprun</div><div>%mprun, %memit</div><div>  \
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px \
solid rgb(204,204,204);padding-left:1ex"><span class="gmail-"> &gt; #30113 - Allow \
helper functions to wrap sys.setprofile<br> &gt; #18971 - Use argparse in the \
profile/cProfile modules<br> &gt; #30118 - Add unittest for cProfile/profile command \
line interface<br> &gt;<br>
&gt; It can divide into two categories, first is the context manager problem, and<br>
&gt; the second is optparse to argparse problem.<br>
&gt;<br>
&gt; 1. context manager problem:<br>
&gt;<br>
&gt; Relative issue: #9285, #30113<br>
&gt; Relative PR: #287, #1212, #1253<br>
&gt;<br>
&gt; This is an issue since 2010, and stop at profile can&#39;t simply add a<br>
&gt; __enter__ and __exit__ to make it a context manager. The main problem is,<br>
&gt; sys.setprofile() will hit the return and get bad return in profile<br>
&gt; dispatch_return function. The solution is to insert a simulate call in the<br>
&gt; helper function, to provide the context between helper frame and where the<br>
&gt; profile is defined.<br>
<br>
</span>I&#39;d like to second Louie&#39;s call for additional review here. I&#39;ve \
been<br> reviewing them so far, and they look sensible to me, but I don&#39;t<br>
personally know the profile code base at all,</blockquote><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"> so there&#39;s a strong<br> chance I&#39;ll miss \
subtle details.<br></blockquote><div><br></div><div><a \
href="https://westurner.github.io/wiki/awesome-python-testing#benchmarks">https://westurner.github.io/wiki/awesome-python-testing#benchmarks</a><br></div><div>- \
plop,</div><div><br></div><div><br></div><div><br></div><div><a \
href="https://github.com/python/cpython/blob/master/Lib/profile.py">https://github.com/python/cpython/blob/master/Lib/profile.py</a><br></div><div><a \
href="https://github.com/python/cpython/blob/master/Lib/cProfile.py">https://github.com/python/cpython/blob/master/Lib/cProfile.py</a> \
</div></div></div></div>



_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/python-dev-marcsub-zyf4%40marc.info


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic