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.

Multiprocessing Testbed Overview

Give Feedback

In this lesson, you’re going to look at a little testbed program that you’re going to build and use to measure execution time with the time.time() function, so that you can compare the single-threaded and multithreaded implementations of the same algorithm.

In the next lesson, you’ll see why you’d want to do all this. Because you wrote your code in a functional programming style, you can parallelize it fairly easily. There’s a parallel map construct that you can use. That way, you can run your processing steps in parellel.

Comments & Discussion

Pygator on Jan. 20, 2020

At the end you say it’s being processed in parallel, but we haven’t used anything from the multiprocessing module, so it’s still running serially.

Dan Bader RP Team on Jan. 21, 2020

@Pygator: Thanks, what I meant to say there at the end was “once we bring in multiprocessing this will allow us to see how the elements are processed in parallel.”

This lesson just sets up the testbed so we can measure the speed improvements we’ll get from parallelizing this code. Check out the next lesson where we’ll actually bring in the multiprocessing module to execute these transformations concurrently.

juanC on April 4, 2020

I needed to “import time” to get the time.sleep(1) command to work (running Python 3.7). Is that normal?

juanC on April 4, 2020

(wish I could edit/delete my previous post) Ignore that, missed the import the first time. Sorry!

ericguo021 on June 5, 2020

Hello Dan, What’s the IDE you used for tutorial?

Dan Bader RP Team on June 5, 2020

I’m using an alternative Python REPL called bpython in my videos. You can learn more about it here: If bpython is difficult to install, I can also recommend ptpython.

I’m running the REPL inside iTerm 2 on macOS, and the editor is Sublime Text.

Become a Member to join the conversation.