osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Research paper "Energy Efficiency across Programming Languages: How does energy, time, and memory relate?"


On 9/16/2017 7:04 PM, breamoreboy at gmail.com wrote:
> I thought some might find this https://sites.google.com/view/energy-efficiency-languages/ interesting.

By 'energy', they only mean electricity, not food calories. This is the 
email I sent to the authors.
-----------

As a two-decade user of Python, I was interested to read your paper. 
Unfortunately, it is deeply flawed with respect to Python in the sense 
that your conclusions are inapplicable to real-world usage of Python.

The problem is your use of the Computer Language Benchmark Game.  As the 
name says, it is a *game*.  As a game, it has artificial rules dictated 
by the game masters.  It uses toy problems, and for Python, the rules 
dictate unrealistic toy solutions.  In particular, it appears to 
disallow use of 'import' with 3rd-party modules, whereas real-world 
Python is expected to use them, and nearly always does.

The particular crippler for CLBG problems is the non-use of numpy in 
numerical calculations, such as the n-body problem.  Numerical python 
extensions are over two decades old and give Python code access to 
optimized, compiled BLAS, LinPack, FFTPack, and so on.  The current one, 
numpy, is the third of the series.  It is both a historical accident and 
a continuing administrative convenience that numpy is not part of the 
Python stdlib.  However, it is easily installed from the PSF-maintained 
repository (python -m pip install numpy), and is included with most 
third-party distributions of Python.

The numerical extensions have been quasi-official in the sense that at 
least 3 language enhancements have been make for their use.  Nearly all 
real-world scientific, financial, and neural-network Python programs are 
build on top of numpy.  When a Python program spend 95% of the time in 
the optimized compiled C routines, it is nearly as fast as a 100% C 
solution.  The reason people use Python instead of C for the other 5% is 
to save human time.

Even when it come to executing the pure Python solutions, the CLBG rules 
apparently require the slowest execution possible. Execution would be at 
least 2 to 5 times faster if compilation to machine code were allowed, 
either before or during execution.  But the point of the game is to 
provide a 'level' playing field for competition between Python 
programmers, even if the cost is to cripple comparison with other 
language solution.

Terry Jan Reedy




-- 
Terry Jan Reedy