Cpython optimization

Olof Bjarnason olof.bjarnason at gmail.com
Fri Oct 23 15:53:02 CEST 2009

2009/10/23 Antoine Pitrou <solipsis at pitrou.net>

> Le Fri, 23 Oct 2009 09:45:06 +0200, Olof Bjarnason a écrit :
> >
> > So I think my first question is still interesting: What is the point of
> > multiple cores, if memory is the bottleneck?
> Why do you think it is, actually? Some workloads are CPU-bound, some
> others are memory- or I/O-bound.

Big I/O operations have even less chance of gaining anything from being
parallellized (quite the opposite I would guess due to synchronization

Operations that uses very little memory, say some mathematical computations
that can fit in 16 registers, have a lot to gain in being parallellized, of
course. Maybe computing small-formulae fractals is a good example of this?

My question was regarding the most hard-to-tell and, sadly also the most
common, trying to speed up algorithms that work over big data structures in
primary memory. Things like drawing lines, doing image processing,
multiplication of large matrices, ray tracing.... Basically anything with
large amounts of input information/buffers/structures, stored in primary

This would be way to speed up things in an image processing algorithm:
1. divide the image into four subimages
2. let each core process each part independently
3. fix&merge (along split lines for example) into a resulting, complete

Notice that no gain would be achieved if the memory was shared among the
cores, at least not if the operation-per-pixel is faster than the read/write
into memory.

> You will find plenty of benchmarks on the Web showing that some workloads
> scale almost linearly to the number of CPU cores, while some don't.
> --
> http://mail.python.org/mailman/listinfo/python-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091023/48913d24/attachment.html>

More information about the Python-list mailing list