Code optimisation
Changing code so it runs faster, uses less memory or is easier to read, without changing what it does. For example, removing repeated code or using a built-in function.
Understanding Code optimisation in VCE Software Development U3O1
What it does: Binary search finds the middle of the remaining range each time and halves the search space. This is a better algorithm than a linear search through every item. A descriptive name like average_mark makes the code easier to read and keeps the same behaviour, which shows the readability side of optimisation. Optimisation changes how the code works internally, not what it does. If the output changes, it is no longer optimisation. Built-in functions like sum() are tested, short and usually faster than hand-written code. They also work for any list length. Always test after optimising. The same test cases should still pass.
Common mistakes: len() needs a list, but total is a single number, so this causes a TypeError. Using the built-in sum() is a good optimisation, but the average must divide by len(marks). len(names) is a number and cannot be looped over, so this causes a TypeError. A loop replaces repeated print lines, but it must loop over the list itself: for name in names:.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 178–193) and word search (Modules 168–193).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
optimisationFill in the Blanks
Spot the Error
Student with a class code? Join your class →