Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ This is an all-day course, however it normally finishes by early afternoon.
<!-- TODO: course duration? -->
<!-- TODO: confident code syllabus? -->

## Motivation

Why might you want to profile and optimise your code?

The simplest answer is that optimisation let you get results faster. It may also allow you to scale up your code to perform larger analyses that would otherwise have taken too long to be practical.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rough tweak, putting a bit more emphasis on confidence in code quality (e.g. there's still a benefit even if profiling looks reasonable)

Suggested change
The simplest answer is that optimisation let you get results faster. It may also allow you to scale up your code to perform larger analyses that would otherwise have taken too long to be practical.
The simplest answer is that profiling helps you validate that the performance of your code matches your expectations. If it doesn't, then you'll either identify an optimisation which will let you get results faster, or have gained a better understanding of what your code is doing.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm … this is probably dependent on the target audience? I think for experienced software engineers, profiling becomes more about confirming that the performance matches expectations; but software performance is notoriously unintuitive—and especially so in a high-level language like Python, where you’d need to understand an additional layer of language implementation details to develop a decent intuition.

For the target audience of this course, I’d expect that most of them don’t have a well-developed intuition (yet—that’s part of what we try to develop in the optimisation section, after all!) … so I don’t think opening with this as the main motivation is a good fit.

Copy link
Copy Markdown
Collaborator

@Robadob Robadob Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair, however I'd contend that many of the most obvious performance issues in novice code flagged by a profiler require no expertise to identify beyond being the author of the code.

E.g. an old crude validation method, file IO or merely anything that isn't the "computational" bit of an algorithm.

However, I have definitely seen cases where it's not immediately obvious to the "novice", e.g. bespoke C++ vector class, nothing is inlined, their response was "well that's the maths, of-course it's expensive (or something to that effect).

Your position definitely applies to the more nuanced stuff, such as using NumPy and data-structures correctly though.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to include this, I’d probably leave Liz’ writing unmodified and rather add a separate paragraph at the end—maybe framing it like “Even if you don’t find any major performance gains, this will be useful because … [confidence, better understanding, …]”


Making your code faster can have additional benefits: faster software uses less compute power. If you use paid-for compute resources, such as cloud computing or some HPC facilities, optimising your code can therefore reduce your costs.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to merge in the bit I had to strip out above.

Suggested change
Making your code faster can have additional benefits: faster software uses less compute power. If you use paid-for compute resources, such as cloud computing or some HPC facilities, optimising your code can therefore reduce your costs.
Making your code faster can either enable larger analyses that would otherwise be impractical or reduce redundant computation. If you use paid-for compute resources, such as cloud computing or some HPC facilities, optimising your code can therefore reduce your costs.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think that works with the following sentence—enabling larger analyses (implicitly: using the same resources) will not “reduce your costs”, it will just get more results at the same cost.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, "reduce your cost per unit of work", but that sounds shit.


Using less computing power also helps make your software more environmentally sustainable. As funders and research institutions set Net Zero goals, and computationally-intensive research expands, sustainability is increasingly becoming a concern for researchers.

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

### Green computing

To find out more about sustainable computing, visit the [Green DiSC](https://www.software.ac.uk/GreenDiSC) website or see this [online training](https://learn.greensoftware.foundation/) from the Green Software Foundation.

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

However, it's sensible to focus your optimisation efforts on the parts of the code that take the longest. This is where profiling comes in: by profiling your code, you can identify which parts contribute the most to its runtime, and target these for optimisation.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
However, it's sensible to focus your optimisation efforts on the parts of the code that take the longest. This is where profiling comes in: by profiling your code, you can identify which parts contribute the most to its runtime, and target these for optimisation.
However, it's sensible to focus your optimisation efforts on the parts of the code that take the longest. This is where profiling comes in: By profiling your code, you can identify which parts contribute the most to its runtime, and target these for optimisation.

Feel free to ignore if this is something where different style guides disagree, but I was taught to use sentence case after a colon if a complete sentence follows.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never come across that capitalization rule before! I looked it up and it does seem to be something where different style guides recommend differently, so I'll leave it as-is.

Even if you don’t find any major performance gains, profiling can give you a better understanding of what your code is doing, or give you confidence that the performance of your code matches your expectations.

## Learning Objectives
<!-- Aim for 3-4 objectives for every 6 hours of training -->
Expand Down
Loading