source code size metric: Python and modern C++

Neal Norwitz neal at metaslash.com
Sun Dec 1 22:44:38 EST 2002


On Sun, 01 Dec 2002 21:09:28 -0500, Pavel Vozenilek wrote:

> (I do not wish to start any religious war here, please.)
> 
> Guido van Rossum in his article
> (http://www.python.org/doc/essays/comparisons.html) compares C++ and
> Python and finds Python source often 5-10 smaller than equivalent C++.
> 
> Has somebody experience what the situation is for modern C++ (the one
> with STL, Boost, etc.)? I am interested in larger systems handling
> complex data structures.
> 
> I will be glad to get info/links on this single metric, without going
> into "who is better" discussion, please. I know the answer is _more_
> complicated than single number and am curious on practical experience.

http://www.metaslash.com/brochure/recall.html

This is a real world example of an open source project.
Short answer for the lazy:

               Main Code  Support Code   Example's Code
C++               4988         3105          2573
Python and IDL    1858            0           659

In sum (2517 for Python vs. 10666 for C++), that's a factor of over 4.
The person doing the code was very proficient in both C++ & Python.
Although the Python lines could be a bit lower if he used a more
recent version of python.  I think he stuck w/1.5.2.

Neal



More information about the Python-list mailing list