Chapter 5. Running Tasks in Parallel
To speed up rake tasks, you could do a lot of things, starting with simple refactoring and ending with algorithm improvements. However, the easiest and the most efficient way is parallelism. It means that you invoke your chunks of code simultaneously in their own threads, if that's possible, instead of executing them consequently. This is why the finish time will be shorter in theory.
In this chapter, we will see how to use this feature and how Rake uses multithreading to run tasks in parallel. The chapter includes the following topics:
Defining tasks with parallel prerequisites
Thread safety of multitasks
Multiple task definitions with a common prerequisite
Applying multitasks in practice