Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Measuring Execution Time in the multiprocessing Testbed

Give Feedback

In this lesson, you’ll extend your testbed to add some logging so you can trace how long it takes to calculate your result. You’ll measure the execution time with the time.time() function, which we’ll use to compare the single-threaded and multithreaded implementations of the same algorithm.

In the next lesson, you’ll take a look at the multiprocessing.Pool class and its parallel map implementation, which make it a lot easier to parallelize most Python code that is written in a functional style.

Comments & Discussion

dvorobej on April 13, 2020

multiprocessing doesnt seem to be working in Jupyter Notebooks. Dan, any advice on how to overcome it? Thanks

Dan Bader RP Team on April 13, 2020

Hmm I’ve never tried running multiprocessing tasks inside a Jupyter Notebook, it’s possible that that’s simply unsupported. You may need to run your multiprocessing code from the command-line or in a different REPL environment.

As an alternative, I found this third-party library called nbmultitask that provides an interactive Jupyter Notebook widget for controlling parallel execution. Hope that helps you out :)

Muhammad Tayyab Asghar on June 7, 2020

@Dan Bader this course is great but one thing i hate is sound of “Mark as Complete” it really gives me a headache. The video is completed and you are thinking about the video lesson and “Boom” there is that sound. Can you please tell how to shut it off.

Become a Member to join the conversation.