Skip to content

Commit

Permalink
Neil comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Robadob committed Mar 22, 2024
1 parent 0f15f24 commit d2d069e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions episodes/profiling-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,14 @@ In this simple example the execution is fairly evenly balanced between all of th

Below the icicle diagram, there is a table similar to the default output from `cProfile`. However, in this case you can sort the columns by clicking their headers and filter the rows shown by entering a filename in the search box. This allows built-in methods to be hidden, which can make it easier to highlight optimisation priorities.

**Notebooks**

If you followed along inside a notebook it might look like this:

![The worked example inside a notebook.](episodes/fig/snakeviz-worked-example-notebook.png){alt="A Jupyter notebook showing the worked example profiled with snakeviz." width=80%}

Because notebooks operate by creating temporary Python files, the filename (shown `1378276351.py` above) and line numbers are not too useful should still be helpful. The function names follow the temporary file name in parentheses, e.g. `1378276351.py:3(a_1)`, `1378276351.py:9(b_1)` and so forth.

::::::::::::::::::::::::::::::::::::: callout

## Sunburst
Expand All @@ -342,16 +350,10 @@ This provides the same information as "Icicle", however the rows are instead cir
The sunburst visualisation displays less text on the boxes, so it can be harder to interpret. However, it increases the visibility of boxes further from the root call.

<!-- TODO: Alt text here is redundant? -->
![An sunburst visualisation provided by `snakeviz` for the worked example's Python code.](episodes/fig/snakeviz-worked-example-sunburst.png){alt="The snakeviz sunburst visualisation for the worked example Python code." width=50%}
![An sunburst visualisation provided by `snakeviz` for the worked example's Python code.](episodes/fig/snakeviz-worked-example-sunburst.png){alt="A sunburst visualisation for the worked example Python code." width=50%}

:::::::::::::::::::::::::::::::::::::::::::::

If you followed along inside a notebook it might look like this:

![The worked example inside a notebook.](episodes/fig/snakeviz-worked-example-notebook.png){alt="A Jupyter notebook showing the worked example profiled with snakeviz." width=80%}

Because notebooks operate by creating temporary Python files, the filename (shown `1378276351.py` above) and line numbers are not too useful should still be helpful. The function names follow the temporary file name in parentheses, e.g. `1378276351.py(a_1)` `1378276351.py(b_1)` and so forth.


## Exercises

Expand Down

0 comments on commit d2d069e

Please sign in to comment.