Browse Source

Profiling

pull/109/merge
Jure Šorn 1 year ago
parent
commit
1f577da412
3 changed files with 12 additions and 14 deletions
  1. 9
      README.md
  2. 13
      index.html
  3. 4
      parse.js

9
README.md

@ -1936,7 +1936,7 @@ with <conn>.begin(): ... # Exits the block with commit or
```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 |
@ -2598,8 +2598,7 @@ duration_in_seconds = perf_counter() - start_time
### Profiling by Line
```text
$ pip3 install line_profiler
$ echo "
@profile
$ echo "@profile
def main():
a = list(range(10000))
b = set(range(10000))
@ -2615,8 +2614,8 @@ Line # Hits Time Per Hit % Time Line Contents
### Call and Flame Graphs
```text
$ pip3 install gprof2dot snakeviz
$ apt/brew install graphviz
$ 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

13
index.html

@ -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 &gt; 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 '&lt;path&gt;:.' <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>

4
parse.js

@ -461,12 +461,12 @@ const DIAGRAM_9_B =
const DIAGRAM_95_A =
'+------------+--------------+----------+----------------------------------+\n' +
'| Dialect | pip3 install | import | Dependencies |\n' +
'| Dialect | pip3 install | import | Dependencies |\n' +
'+------------+--------------+----------+----------------------------------+\n';
const DIAGRAM_95_B =
'┏━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n' +
'┃ Dialect │ pip3 install │ import │ Dependencies ┃\n' +
'┃ Dialect │ pip3 install │ import │ Dependencies ┃\n' +
'┠────────────┼──────────────┼──────────┼──────────────────────────────────┨\n' +
'┃ mysql │ mysqlclient │ MySQLdb │ www.pypi.org/project/mysqlclient ┃\n' +
'┃ postgresql │ psycopg2 │ psycopg2 │ www.pypi.org/project/psycopg2 ┃\n' +

Loading…
Cancel
Save