[Haskell-cafe] code length in Haskell, a comparison

Feng, Boqun abstractionfbq at gmail.com
Tue Nov 20 14:32:24 CET 2012


Why C++ appears twice in the Overall rank?


2012/11/20 Gregory Guthrie <guthrie at mum.edu>

> There is some interesting data in the article at:
>
>    Code Length Measured in 14 Languages
>
> http://blog.wolfram.com/2012/11/14/code-length-measured-in-14-languages/
>
> basically comparing program lengths in various languages, and some ensuing
> discussion of how this relates to language expressiveness, etc.
> (He does all of his analysis in Mathematica, which is the goal of the
> article.)
>
> It is interesting to see how well Haskell showed in the data; and it would
> also be interesting to see how well it could replicate the analysis example
> which was a nice example of web data scraping!
>
> The data is the length of a series of programs written in a number of
> languages (data from: http://rosettacode.org/wiki/Rosetta_Code).
> (The columns don't map well to text only, Haskell column marked with ≡≡≡≡
> (Why doesn't this list support HTML?)).
>   See nicer version at: http://pastehtml.com/view/ciy7woohv.rtxt
>
> The average for Haskell of 1.89 means that on the average the same program
> in Haskell takes ~2x in the other languages.
> Given the correlation of size to clarity, complexity, effort, and errors,
> this is a good thing! :-)
>
>         Code Size relative to Mathematica
>         Larger numbers indicate that the language on top needs more code.
>
>         C       C++     Fortran Java    CLisp   Python  C#      JavaScript
>      R       MATLAB  Clojure Pascal  Haskell Ruby    Average
>              ???????????        ????    ????    ????    ????    ????
>  ????    ????    ????    ????    ????    ????    ????    ≡≡≡≡    ????
>         Mathematica     17.0    9.1     8.1     6.4     6.3     7.2
> 6.4     5.0     3.2     3.2     1.6     5.8     3.5     5.2     6.29
>         Ruby            2.7     1.8     1.9     1.3     1.1     1.1
> 1.5     1.0     0.7     0.9     0.4     1.4     0.7             1.27
>         Haskell 3.6     2.7     2.5     2.0     1.6     1.7     2.2
> 1.5     1.1     1.5     0.7     2.1             1.4     1.89
>         Pascal          2.2     1.5     1.2     0.8     0.8     0.8
> 1.0     0.8     0.5     0.6     0.2             0.5     0.7     0.89
>         Clojure 8.8     5.3     5.2     3.6     3.7     3.3     3.8
> 2.5     1.9     2.9             5.0     1.5     2.6     3.85
>         MATLAB  3.6     2.4     1.8     1.1     1.4     1.1     1.7
> 0.9     0.8             0.3     1.6     0.7     1.1     1.42
>         R               4.7     3.3     2.4     1.9     1.8     1.7
> 2.1     1.5             1.3     0.5     2.2     0.9     1.4     1.98
>         JavaScript      2.8     2.1     1.9     1.2     1.2     1.1
> 1.6             0.7     1.1     0.4     1.3     0.7     1.0     1.31
>         C#              2.0     1.4     1.3     0.9     0.8     0.8
>       0.6     0.5     0.6     0.3     1.0     0.5     0.7     0.87
>         Python          2.2     1.6     1.5     1.1     0.9
> 1.2     0.9     0.6     0.9     0.3     1.3     0.6     0.9     1.07
>         Common Lisp     2.8     1.8     1.6     1.3             1.1
> 1.3     0.8     0.6     0.7     0.3     1.3     0.6     0.9     1.16
>         Java            2.1     1.4     1.5             0.8     0.9
> 1.1     0.8     0.5     0.9     0.3     1.2     0.5     0.8     0.98
>         Fortran 1.4     1.0             0.7     0.6     0.7     0.8
> 0.5     0.4     0.6     0.2     0.8     0.4     0.5     0.66
>         C++             1.4             1.0     0.7     0.6     0.6
> 0.7     0.5     0.3     0.4     0.2     0.7     0.4     0.6     0.61
>         C                       0.7     0.7     0.5     0.4     0.5
> 0.5     0.4     0.2     0.3     0.1     0.5     0.3     0.4     0.41
>           ????????????  ????    ????    ????    ????    ????    ????
>  ????    ????    ????    ????    ????    ????    ≡≡≡≡    ????
>         Overall:        4.1     2.58    2.3     1.68    1.56    1.61
>  1.85    1.27    0.85    1.14    0.41    1.86    0.83    1.29
>
> Overall Ranking:
>    Clojure              0.41
>    Haskell              0.83
>    R                    0.85
>    MATLAB               1.14
>    JavaScript           1.27
>    Ruby                         1.36
>    Common Lisp          1.56
>    Python               1.61
>    C++                  1.68
>    C#                   1.85
>    Pascal               1.86
>    Fortran              2.33
>    C++                  2.58
>    C                    4.09
> -------------------------------------------
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 

Feng, Boqun
School of Software,Shanghai Jiao Tong University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121120/7a02db10/attachment.htm>


More information about the Haskell-Cafe mailing list