Python typically runs all your code on a single core. Even when the program that you're running has components that can easily run in parallel. To make programs faster in parallel scenarios you might want to explore ray. It's not the only tool for this use-case but it's a tool we've come to like.
When you rerun this cell, it's super fast!
%%time results = ray.get(futures)
But that's because the computation doesn't rerun. If you re-initialize the
futures then it will.
futures = [birthday_experiment.remote(class_size=size, n_sim=10_000) for size in range(2, 10)]
Feedback? See an issue? Something unclear? Feel free to mention it here.
If you want to be kept up to date, consider signing up for the newsletter.