Browse Source

Profile

pull/44/head
Jure Šorn 5 years ago
parent
commit
7249863649
2 changed files with 24 additions and 24 deletions
  1. 24
      README.md
  2. 24
      index.html

24
README.md

@ -2446,22 +2446,22 @@ main()
```text ```text
$ kernprof -lv test.py $ kernprof -lv test.py
Line # Hits Time Per Hit % Time Line Contents Line # Hits Time Per Hit % Time Line Contents
======================================================== =======================================================
1 @profile 1 @profile
2 def main(): 2 def main():
3 1 1128.0 1128.0 27.4 a = [*range(10000)] 3 1 1128.0 1128.0 27.4 a = [*range(10000)]
4 1 2994.0 2994.0 72.6 b = {*range(10000)} 4 1 2994.0 2994.0 72.6 b = {*range(10000)}
``` ```
```text ```text
$ python3 -m memory_profiler test.py $ python3 -m memory_profiler test.py
Line # Mem usage Increment Line Contents Line # Mem usage Increment Line Contents
======================================================== =======================================================
1 35.387 MiB 35.387 MiB @profile 1 35.387 MiB 35.387 MiB @profile
2 def main(): 2 def main():
3 35.734 MiB 0.348 MiB a = [*range(10000)] 3 35.734 MiB 0.348 MiB a = [*range(10000)]
4 36.160 MiB 0.426 MiB b = {*range(10000)} 4 36.160 MiB 0.426 MiB b = {*range(10000)}
``` ```
### Call Graph ### Call Graph

24
index.html

@ -2098,20 +2098,20 @@ main()
</code></pre></div> </code></pre></div>
<pre><code class="text language-text">$ kernprof -lv test.py <pre><code class="text language-text">$ kernprof -lv test.py
Line # Hits Time Per Hit % Time Line Contents Line # Hits Time Per Hit % Time Line Contents
======================================================== =======================================================
1 @profile 1 @profile
2 def main(): 2 def main():
3 1 1128.0 1128.0 27.4 a = [*range(10000)] 3 1 1128.0 1128.0 27.4 a = [*range(10000)]
4 1 2994.0 2994.0 72.6 b = {*range(10000)} 4 1 2994.0 2994.0 72.6 b = {*range(10000)}
</code></pre> </code></pre>
<pre><code class="text language-text">$ python3 -m memory_profiler test.py <pre><code class="text language-text">$ python3 -m memory_profiler test.py
Line # Mem usage Increment Line Contents Line # Mem usage Increment Line Contents
======================================================== =======================================================
1 35.387 MiB 35.387 MiB @profile 1 35.387 MiB 35.387 MiB @profile
2 def main(): 2 def main():
3 35.734 MiB 0.348 MiB a = [*range(10000)] 3 35.734 MiB 0.348 MiB a = [*range(10000)]
4 36.160 MiB 0.426 MiB b = {*range(10000)} 4 36.160 MiB 0.426 MiB b = {*range(10000)}
</code></pre> </code></pre>
<div><h3 id="callgraph">Call Graph</h3><div><h4 id="generatesapngimageofacallgraphwithhighlightedbottlenecks">Generates a PNG image of a call graph with highlighted bottlenecks:</h4><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install pycallgraph</span> <div><h3 id="callgraph">Call Graph</h3><div><h4 id="generatesapngimageofacallgraphwithhighlightedbottlenecks">Generates a PNG image of a call graph with highlighted bottlenecks:</h4><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install pycallgraph</span>
<span class="hljs-keyword">from</span> pycallgraph <span class="hljs-keyword">import</span> output, PyCallGraph <span class="hljs-keyword">from</span> pycallgraph <span class="hljs-keyword">import</span> output, PyCallGraph

|||||||
100:0
Loading…
Cancel
Save