How to Measure Execution Time in Google Colab

Google Colab is a fantastic environment to write Python code using Jupyter Notebooks, hosted for free by Google.

If you’ve ever used Jupyter Notebooks before, it is the same principle, you write Python code in a cell and you are able to execute each cell as you require.

Measure Execution Time

But how would you measure the time each cell takes to execute?

Luckily, within Google Colab, you are able to install additional Python Packages through pip by prepending the command with an exclamation mark !.

!pip install ipython-autotime

%load_ext autotime

Make sure to execute the above code at the start of your notebook, before other cells.

Now when you run a cell, it will append the time it took to execute at the bottom:

Tags:
0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments