Speech Efficiency - whāomotanga


Discuss Kōrero Mai: What is Efficiency in programming

Efficient programming is programming in a manner that uses a low amount of resources.

As you know, algorithms & programs are designed by humans. Different designers may use different algorithms, or sequences of codes, to perform particular tasks.

Some algorithms are very large and use lots of resources while others are more efficient.

How do you think you could make an algorithm or program more efficient?



How can we make algorithms & programs efficient

Here are some different ideas to make algorithms & programs more efficient.


Discuss Kōrero Mai: Why is it important to make algorithms & programs efficient

Improved efficiency =

  • better functionality,
  • faster applications,
  • improved performance,
  • simpler user interface,
  • happier user!


  • Ready? Kua reri? - Ready? it's your turn... Efficient algorithms

    ByteEd needs to move to the purple square. Which algorithm is the most efficient? Why?



    Efficient algorithms practice
    Create solutions for ByteEd to move to the purple square. Avoid the rocks.



    How do different data sizes affect the efficiency of a programme

    Speech Virtual Reality - ao mariko


    The type of data we need to store and use within our code can actually effect how long the application takes to run.

    Knowing which is the best data type to use in our application is one of the many ways of creating more efficient code.

    Example: We don’t need to use a string to store a value of “true”. We can use a Boolean instead.


    How does this affect the applications speed?

    Think of your computer’s CPU (The ‘brain’ of a computer that runs all of our instructions). This CPU can only process so much data at a time. So what happens if we create a application that has lots of unnecessary data?

    The CPU still has to go through it all, which slows it down.

    Think of your CPU as a water bottle. The more water inside of the bottle (the more data that it has to process), the longer it takes for all of the water to come out. This is because the bottleneck (CPU) can only output a small amount of water at a time.



    How to make the application more efficient?

    At this stage, there is no way of changing the size of the bottleneck (CPU). But, we can instead change the amount of water that’s inside of the water bottle to begin with.

    This is what creating efficient use of data types is. The less wasted data there is, the quicker the CPU can process it all and make its way through all of the instructions.

    The less water the better!


    Discuss Kōrero Mai: Where can we see this in real life applications?

    What applications have you used recently that show large amounts of data has an effect on processing speed?

    Some common examples could waiting for a game to load, or waiting for a high detail video to play.



    Where are some other examples where you can see this?


    Visualization of data sizes

    Watch this video on visualizing data sizes. You can see how quickly applications can grow exponentially in data size.


    Discuss Kōrero Mai: How to reduce data size use in applications

    Discuss amongst yourselves what are some possible ways to reduce the amount of data your application uses.
    Some potential answers could be:

  • Checking if the most efficient type of data is being used. E.g Integers instead of floats for whole numbers.
  • Checking if your application doesn't have any unnecessary loops or instructions.
  • Checking if you have any unused variables that could be taking up space.


  • Ready? Kua reri? - Ready? It's your turn... Creating a more efficient program

    The exercise below requires you to analyse the application and determine what can be changed to reduce the time it takes to complete. The loops used in this exercise are exaggerated to simulate a full database worth of instructions and data.