[Pharo-project] Counting Messages as a Proxy for Average Execution Time in Pharo
pharo at stefan-marr.de
Fri Apr 29 16:25:22 CEST 2011
On 29 Apr 2011, at 16:55, Alexandre Bergel wrote:
> I though about your email. I do not understand why automatic parallelization is not the way to go. In my opinion, the computer has much more knowledge about the programmer about where side effects appear and where to cut or split a computation.
> Actually, if I want to be provocative, I would say that parallelization cannot be effective without being automatic. For a similar reason that the compiler will always know better than me how to properly allocate registers.
First, compilers have always the limitations and heuristics for the common case.
The stuff I am most interested in, i.e., interpreters, are an extreme challenge for compilers.
Carefully designed and optimized assembler code will always outperform a compiler in that case.
But ok, interpreters are not the common case for most compilers...
But still, it is always about what the compiler is allowed to assume and what kind of knowledge is encoded in a program.
If you write an inherently sequential program, like an algorithm for huffman decoding, no compiler on the world will stand a chance to automatically parallelize that.
However, if you encode you programs in a way, like Guy Steele proposes, that is, making the opportunity for parallelism obvious, than you also have a chance to benefit from that.
Thus, solve you problems using data structures that allow parallel execution: get rid of linked lists, abandoned all kind of linear data structures. Use trees! TREES! Trees have always been good for the environment and for humans. And nowadays they are the way to go for green computing ;)
And whether you prefer to have you language/VM to do a 'spawn' here or there or whether you put it in explicitly, well, thats a matter of taste or religion...
The important thing that matters is that the structure of your problem allows for parallelization.
> I feel it would be cheaper for me to buy a faster computer than to learn how to program in a multi-core fashion.
Ehm, I assume you haven't bought a computer the last 5 years, otherwise you would have noticed that you can't do that anymore...
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
Phone: +32 2 629 2974
Fax: +32 2 629 3525
More information about the Pharo-project