|
|
@ -54,7 +54,7 @@ |
|
|
|
|
|
|
|
<body> |
|
|
|
<header> |
|
|
|
<aside>June 30, 2023</aside> |
|
|
|
<aside>July 4, 2023</aside> |
|
|
|
<a href="https://gto76.github.io" rel="author">Jure Šorn</a> |
|
|
|
</header> |
|
|
|
|
|
|
@ -1610,7 +1610,7 @@ CompletedProcess(args=[<span class="hljs-string">'bc'</span>, <span class="hljs- |
|
|
|
</code></pre></div> |
|
|
|
|
|
|
|
<pre><code class="text language-text">┏━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ |
|
|
|
┃ Dialect │ pip3 install │ import │ Dependencies ┃ |
|
|
|
┃ Dialect │ pip3 install │ import │ Dependencies ┃ |
|
|
|
┠────────────┼──────────────┼──────────┼──────────────────────────────────┨ |
|
|
|
┃ mysql │ mysqlclient │ MySQLdb │ www.pypi.org/project/mysqlclient ┃ |
|
|
|
┃ postgresql │ psycopg2 │ psycopg2 │ www.pypi.org/project/psycopg2 ┃ |
|
|
@ -2129,8 +2129,7 @@ duration_in_seconds = perf_counter() - start_time |
|
|
|
</code></pre></div> |
|
|
|
|
|
|
|
<div><h3 id="profilingbyline">Profiling by Line</h3><pre><code class="text language-text">$ pip3 install line_profiler |
|
|
|
$ echo " |
|
|
|
@profile |
|
|
|
$ echo "@profile |
|
|
|
def main(): |
|
|
|
a = list(range(10000)) |
|
|
|
b = set(range(10000)) |
|
|
@ -2144,8 +2143,8 @@ Line # Hits Time Per Hit % Time Line Contents |
|
|
|
4 1 487.0 487.0 68.9 b = set(range(10000)) |
|
|
|
</code></pre></div> |
|
|
|
|
|
|
|
<div><h3 id="callandflamegraphs">Call and Flame Graphs</h3><pre><code class="text language-text">$ pip3 install gprof2dot snakeviz |
|
|
|
$ apt/brew install graphviz |
|
|
|
<div><h3 id="callandflamegraphs">Call and Flame Graphs</h3><pre><code class="text language-text">$ pip3 install gprof2dot snakeviz; apt/brew install graphviz |
|
|
|
$ tail -n 4 test.py > test.py |
|
|
|
$ python3 -m cProfile -o test.prof test.py |
|
|
|
$ gprof2dot -f pstats test.prof | dot -Tpng -o test.png; xdg-open/open test.png |
|
|
|
$ snakeviz test.prof |
|
|
@ -2933,7 +2932,7 @@ $ pyinstaller script.py --add-data '<path>:.' <span class="hljs-comment"> |
|
|
|
|
|
|
|
|
|
|
|
<footer> |
|
|
|
<aside>June 30, 2023</aside> |
|
|
|
<aside>July 4, 2023</aside> |
|
|
|
<a href="https://gto76.github.io" rel="author">Jure Šorn</a> |
|
|
|
</footer> |
|
|
|
|
|
|
|