From d2d069e8cc919c4bcf5408771859b99429b54d24 Mon Sep 17 00:00:00 2001 From: Robert Chisholm Date: Fri, 22 Mar 2024 15:22:41 +0000 Subject: [PATCH] Neil comment --- episodes/profiling-functions.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/episodes/profiling-functions.md b/episodes/profiling-functions.md index b9e23e53..6677d194 100644 --- a/episodes/profiling-functions.md +++ b/episodes/profiling-functions.md @@ -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 @@ -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. -![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