How to Measure Execution Time in Google Colab

0 min read 125 words

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:
Andrew
Andrew

Andrew is a visionary software engineer and DevOps expert with a proven track record of delivering cutting-edge solutions that drive innovation at Ataiva.com. As a leader on numerous high-profile projects, Andrew brings his exceptional technical expertise and collaborative leadership skills to the table, fostering a culture of agility and excellence within the team. With a passion for architecting scalable systems, automating workflows, and empowering teams, Andrew is a sought-after authority in the field of software development and DevOps.

Tags