From 6e976a3fe64ab293e0e9d62c3662171ce22bf6fe Mon Sep 17 00:00:00 2001 From: Robert Chisholm Date: Wed, 10 Jan 2024 10:58:31 +0000 Subject: [PATCH] Episode: Profiling conclusion --- config.yaml | 1 + episodes/profiling-conclusion.md | 55 ++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 episodes/profiling-conclusion.md diff --git a/config.yaml b/config.yaml index 2b58cbd..481c2c4 100644 --- a/config.yaml +++ b/config.yaml @@ -63,6 +63,7 @@ episodes: - profiling-introduction.md - profiling-functions.md - profiling-lines.md +- profiling-conclusion.md # Information for Learners learners: diff --git a/episodes/profiling-conclusion.md b/episodes/profiling-conclusion.md new file mode 100644 index 0000000..4d54b40 --- /dev/null +++ b/episodes/profiling-conclusion.md @@ -0,0 +1,55 @@ +--- +title: "Profiling Conclusion" +teaching: 0 +exercises: 0 +--- + + +::::::::::::::::::::::::::::::::::::: objectives + +- Review what has been learned about profiling + +:::::::::::::::::::::::::::::::::::::::::::::::: + +This concludes the profiling portion of the course. + +`cProfile`, `snakeviz` and `line_profiler` have been introduced, these are some of the most accessible Python profiling tools. + +With these transferable skills, if necessary, you should be able to follow documentation to use more advanced Python profiling tools such as [`scalene`](https://github.com/plasma-umass/scalene). + +::::::::::::::::::::::::::::::::::::: keypoints + +What profiling is: + +- The collection and analysis of metrics relating to the performance of a program during execution . + +Why programmers can benefit from profiling: + +- Narrows down the costly areas of code, allowing optimisation to be prioritised or decided to be unnecessary. + +When to Profile: + +- Profiling should be performed on functional code, either when concerned about performance or prior to release/deployment. + +What to Profile: + +- The collection of profiling metrics will often slow the execution of code, therefore the test-case should be narrow whilst remaining representative of a realistic run. + +How to function-level profile: + +- Execute `cProfile` via `python -m cProfile -o