[Python-ideas] Type Hinting - Performance booster ?
Sturla Molden
sturla.molden at gmail.com
Sat Dec 27 03:41:00 CET 2014
Antoine Pitrou <solipsis at pitrou.net> wrote:
> I don't see how that's optimistic. Most workloads are intrinsically
> serial, not parallel.
Henry Ford invented a solution to parallelization of many repetitive serial
tasks 100 years ago. His solution is known as a conveyor belt or pipeline.
If you can split up a serial task into a series of smaller subtasks, you
can chain them as a pipeline of worker threads. It often shows up in signal
processing and multimedia. Take e.g. a look at the design of VTK. You also
have it in e.g. asynchronous i/o if you use threads and queues instead of
coroutines to set up a pipeline.
Then there is big class of data-parallel tasks, such as e.g. in computer
graphics. You e.g. have more than a million pixels on a screen, and each
pixel must be processed independently. MapReduce is also a buzzword that
describes a certain data parallel task. You also find it scientific
computing, e.g. in linear algebra where we use libraries like BLAS and
LAPACK.
Then there is the ForkJoin tasks, a modern buzzword for a certain type of
divide and conquer. A classical example is the FFT. Mergesort would be
another example.
Take a look at a statement like
a = [for foobar(y) in sorted(x)]
Here we have a data parallel iteration over sorted(x) and the evaluation of
sorted(x) is fork-join parallel. Is it unthinkable that a future compiler
could figure this out on its own?
Sturla
More information about the Python-ideas
mailing list