Shootout rankings

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Shootout rankings

Donald Bruce Stewart
:D

Haskell now ranked 2nd overall, only a point or so behind C:

    http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all

And still a bit more we can squeeze out...

-- Don
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Shootout rankings

Gour-2
On Sun, 2006-01-15 at 14:01 +1100, Donald Bruce Stewart wrote:

> :D
>
> Haskell now ranked 2nd overall, only a point or so behind C:
>
>     http://shootout.alioth.debian.org/gp4/benchmark.php?test=all〈=all
>
> And still a bit more we can squeeze out...

I saw it a day or two ago, but thought it mut be some error :-)

Huh, now I have to go doing some Haskell advo *cough* some mailing.

Sincerely,
Gour


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Shootout rankings

Ketil Malde-2
In reply to this post by Donald Bruce Stewart
[hidden email] (Donald Bruce Stewart) writes:

> :D
>
> Haskell now ranked 2nd overall, only a point or so behind C:
>
>     http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all

Very impressive!  And note that if you put zero weight on memory use,
GHC wins by a large margin.  (OTOH, if you take out lines count,
things don't look quite as good :-)

-k
--
If I haven't seen further, it is by standing in the footprints of giants

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Shootout rankings

Jacques Carette
Ketil Malde wrote:

> [hidden email] (Donald Bruce Stewart) writes:
>  
>> Haskell now ranked 2nd overall, only a point or so behind C:
>>
>>     http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all
>>    
>
> Very impressive!  And note that if you put zero weight on memory use,
> GHC wins by a large margin.  (OTOH, if you take out lines count,
> things don't look quite as good :-)
>  
Very impressive indeed.  You don't even need to put zero weight on
memory use for GHC to win.  Personally, I used weights of speed=1,
memory=1, code lines=2, as I believe that _programmer_ efficiency is
just as important as _language_ efficiency.  The one to beat was MLton
under those weights, and GHC is now doing so handily.

It might be worth noting that under the 1,1,2 weigting, and with
"tcp-request-reply" properly deprecated (ie weight=0), the rankings are
Haskell GHC
SML MLton
OCaml
C gcc
so that the functional languages show rather impressively, better than
"portable assembler" (as C ought to be more widely known)

Jacques


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Shootout rankings

Isaac Gouy-2
In reply to this post by Donald Bruce Stewart
> Haskell now ranked 2nd overall, only a point or so
> behind C:

It was always obvious that the "Write the program
as-if lines of code were not being measured" clause
relied too heavily on contributors willingness to
co-operate.

http://shootout.alioth.debian.org/gp4/faq.php#implementlist

Maybe we finally have enough motivation to move to
some other measurement of program volume :-)

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Shootout rankings

Sebastian Sylvan
On 1/15/06, Isaac Gouy <[hidden email]> wrote:

> > Haskell now ranked 2nd overall, only a point or so
> > behind C:
>
> It was always obvious that the "Write the program
> as-if lines of code were not being measured" clause
> relied too heavily on contributors willingness to
> co-operate.
>
> http://shootout.alioth.debian.org/gp4/faq.php#implementlist
>
> Maybe we finally have enough motivation to move to
> some other measurement of program volume :-)
>

I was just thinking about that. Some code is very obfuscated due to
contributors trying to conserve lines of code.

I'm not sure how you could do this better, though... Maybe counting
the number of "tokens" (not sure how you'd define that though) would
reduce code such as foo;bar;baz... That's probably not all that much
better though...

In one way I think the readers would be better served if code-lines
wasn't counted. At least all the code samples would be idiomatic and
clear, so it's easier to click a language and see a nice somewhat
representative example of how code in it looks. But on the other hand
it is interesting to see how languages compare in terms of "elegance"
(and LOC is at least a *simple* way to meassure it).

Perhaps each language can have a "live" and an "elegant" version. So
that you can at least see what an elegant implementation would look
like for each language (but that version isn't benchmarked).

/S

--
Sebastian Sylvan
+46(0)736-818655
UIN: 44640862
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Shootout rankings

haskell-2
In reply to this post by Donald Bruce Stewart
I have added the debugged non-memory-leaking and now sped-up-with-trees
version of the fasta code to the wiki:

http://haskell.org/hawiki/FastaEntra

This will be submitted soon.  I do not think this is a good candidate
for lines-of-code compression/obfuscation.

In speed this entry runs 5.0 times faster than the original
memory-leaking one (on my powerbook G4 with OS 10.4.4)

It runs in 1.8 MB of RSIZE instead of the leaking 339 MB.

I notice the OCaml #2 version uses an array lookup instead of a binary
tree.  Hmmm....

--
Chris
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Shootout rankings

Donald Bruce Stewart
In reply to this post by Sebastian Sylvan
sebastian.sylvan:

> On 1/15/06, Isaac Gouy <[hidden email]> wrote:
> > > Haskell now ranked 2nd overall, only a point or so
> > > behind C:
> >
> > It was always obvious that the "Write the program
> > as-if lines of code were not being measured" clause
> > relied too heavily on contributors willingness to
> > co-operate.
> >
> > http://shootout.alioth.debian.org/gp4/faq.php#implementlist
> >
> > Maybe we finally have enough motivation to move to
> > some other measurement of program volume :-)
> >
>
> I was just thinking about that. Some code is very obfuscated due to

No Sebastian, this is very obfuscated: http://www.cse.unsw.edu.au/~dons/pretty.html

;)

I think saying obfuscated is very unfair. We took advantage of some strengths
of Haskell, such as type inference, to reduce the number of lines. No
worse than, say, the SML MLton entries do -- and why not leverage this advantage,
since our language can do it?

In fact, we have 1 line entries for some of the problems that are just
not competitive, though very instructive. It would be nice to be able to
publish those.

Cheers,
    Don
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Shootout rankings

Sebastian Sylvan
On 1/15/06, Donald Bruce Stewart <[hidden email]> wrote:

> sebastian.sylvan:
> > On 1/15/06, Isaac Gouy <[hidden email]> wrote:
> > > > Haskell now ranked 2nd overall, only a point or so
> > > > behind C:
> > >
> > > It was always obvious that the "Write the program
> > > as-if lines of code were not being measured" clause
> > > relied too heavily on contributors willingness to
> > > co-operate.
> > >
> > > http://shootout.alioth.debian.org/gp4/faq.php#implementlist
> > >
> > > Maybe we finally have enough motivation to move to
> > > some other measurement of program volume :-)
> > >
> >
> > I was just thinking about that. Some code is very obfuscated due to
>
> No Sebastian, this is very obfuscated: http://www.cse.unsw.edu.au/~dons/pretty.html
>
> ;)
>
> I think saying obfuscated is very unfair. We took advantage of some strengths
> of Haskell, such as type inference, to reduce the number of lines. No
> worse than, say, the SML MLton entries do -- and why not leverage this advantage,
> since our language can do it?
>
> In fact, we have 1 line entries for some of the problems that are just
> not competitive, though very instructive. It would be nice to be able to
> publish those.

I wasn't talking specifically about Haskell, but all languages (don't
like browsing around other languages only to see highly compact and
ugly solutions, which really don't give me a good taste for the
langugae).
Still, some Haskell implementations are clearly obfuscated to save
lines in certain circumstances (like: "thread im om = do (x::Int) <-
takeMVar im; putMVar om $! x+1; thread im om" int he cheap
concurrencybenchmark, most people don't write Haskell code with
semi-colons, and when they do they usually sequence them vertically,
not horizontally).


/S

--
Sebastian Sylvan
+46(0)736-818655
UIN: 44640862
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Shootout rankings

Jared Updike
In reply to this post by Sebastian Sylvan
> > Maybe we finally have enough motivation to move to
> > some other measurement of program volume :-)

> I'm not sure how you could do this better, though... Maybe counting
> the number of "tokens" (not sure how you'd define that though)

I was thinking the same thing for the past few weeks: that lexemes or
lexical tokens would be the ideal unit of conciseness in a programming
language. This is revealing:

>From the shootout, for ackermann (counted by hand, given the benefit
of the doubt (i.e. to yield shorter count), excuse any mistakes):
language         lines   lexemes (non-whitespace, non-comment tokens)
Haskell          7        78
Python           10       79*
OCaml            6        87
Standard ML      4        88
Tcl              12       89**
Nice             7        93
Perl             9        95***
c/gcc            8       100****
Java             7        109
D Digital Mars   9        113
Scheme           11       113
* python: 82 if you count string interpolation
** Tcl: 95 if you count string interpolation
*** perl: 109 if you count sigils ($num = 2, $_ = 2) and string
interpolation. note that $_ is a lot harder to type than, say, x.
disclosure: I hate sigils.
**** c: 102 if you count string interpolation

Notice how the number of lines of code is very misleading. Now with
tokens you can't cheat by putting too much code on one line. In fact,
the only way to "cheat" is to redesign the language and make it so you
can say "map" (1 token) instead of "for (int x = 0; x < N; x++)" (14
tokens).

I think that token counts would be a beautiful way to measure the
language itself and not the coder: if you can write a more concise
program in that language, then do it! Nothing is stopping you but the
language's expressiveness itself. Plus I'm convinced that it would be
even more telling for larger programs, where line counts can vary even
more. I'll parse a larger set of programs (nbody, for example) soon
(but not by hand) if anyone is as interested as I am.

  Jared.

--
http://www.updike.org/~jared/
reverse ")-:"
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Shootout rankings

Donald Bruce Stewart
In reply to this post by Sebastian Sylvan
sebastian.sylvan:

> On 1/15/06, Donald Bruce Stewart <[hidden email]> wrote:
> > sebastian.sylvan:
> > > On 1/15/06, Isaac Gouy <[hidden email]> wrote:
> > > > > Haskell now ranked 2nd overall, only a point or so
> > > > > behind C:
> > > >
> > > > It was always obvious that the "Write the program
> > > > as-if lines of code were not being measured" clause
> > > > relied too heavily on contributors willingness to
> > > > co-operate.
> > > >
> > > > http://shootout.alioth.debian.org/gp4/faq.php#implementlist
> > > >
> > > > Maybe we finally have enough motivation to move to
> > > > some other measurement of program volume :-)
> > > >
> > >
> > > I was just thinking about that. Some code is very obfuscated due to
> >
> > No Sebastian, this is very obfuscated: http://www.cse.unsw.edu.au/~dons/pretty.html
> >
> > ;)
> >
> > I think saying obfuscated is very unfair. We took advantage of some strengths
> > of Haskell, such as type inference, to reduce the number of lines. No
> > worse than, say, the SML MLton entries do -- and why not leverage this advantage,
> > since our language can do it?
> >
> > In fact, we have 1 line entries for some of the problems that are just
> > not competitive, though very instructive. It would be nice to be able to
> > publish those.
>
> I wasn't talking specifically about Haskell, but all languages (don't
> like browsing around other languages only to see highly compact and
> ugly solutions, which really don't give me a good taste for the
> langugae).
> Still, some Haskell implementations are clearly obfuscated to save
> lines in certain circumstances (like: "thread im om = do (x::Int) <-
> takeMVar im; putMVar om $! x+1; thread im om" int he cheap
> concurrencybenchmark, most people don't write Haskell code with
> semi-colons, and when they do they usually sequence them vertically,
> not horizontally).

Though often the case, using ; is not without precedent. A quick grep in the
ghc source reveals many:

    get bh = do a <- get bh; b <- get bh; return (a :% b)
    mappM f (x:xs) = do { r <- f x; rs <- mappM f xs; return (r:rs) }
    sequenceM (x:xs) = do { r <- x; rs <- sequenceM xs; return (r:rs) }        
    do { bty1' <- kc_larg_ty bty1; bty2' <- kc_larg_ty bty2; return (InfixCon bty1' bty2') }
    repE (HsApp x y)   = do {a <- repLE x; b <- repLE y; repApp a b}
    ....
   
So for one liners, it's often better than plugging it together with >> and >>=

-- Don

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Shootout rankings

Donald Bruce Stewart
In reply to this post by Jared Updike
jupdike:

> > > Maybe we finally have enough motivation to move to
> > > some other measurement of program volume :-)
>
> > I'm not sure how you could do this better, though... Maybe counting
> > the number of "tokens" (not sure how you'd define that though)
>
> I was thinking the same thing for the past few weeks: that lexemes or
> lexical tokens would be the ideal unit of conciseness in a programming
> language. This is revealing:
>
> >From the shootout, for ackermann (counted by hand, given the benefit
> of the doubt (i.e. to yield shorter count), excuse any mistakes):
> language         lines   lexemes (non-whitespace, non-comment tokens)
> Haskell          7        78
> Python           10       79*
> OCaml            6        87
> Standard ML      4        88

Ah! Just as I thought, SML really was trying very hard ;)

> Tcl              12       89**
> Nice             7        93
> Perl             9        95***
> c/gcc            8       100****
> Java             7        109
> D Digital Mars   9        113
> Scheme           11       113

-- Don
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Shootout rankings

Sebastian Sylvan
In reply to this post by Donald Bruce Stewart
On 1/16/06, Donald Bruce Stewart <[hidden email]> wrote:

> sebastian.sylvan:
> > On 1/15/06, Donald Bruce Stewart <[hidden email]> wrote:
> > > sebastian.sylvan:
> > > > On 1/15/06, Isaac Gouy <[hidden email]> wrote:
> > > > > > Haskell now ranked 2nd overall, only a point or so
> > > > > > behind C:
> > > > >
> > > > > It was always obvious that the "Write the program
> > > > > as-if lines of code were not being measured" clause
> > > > > relied too heavily on contributors willingness to
> > > > > co-operate.
> > > > >
> > > > > http://shootout.alioth.debian.org/gp4/faq.php#implementlist
> > > > >
> > > > > Maybe we finally have enough motivation to move to
> > > > > some other measurement of program volume :-)
> > > > >
> > > >
> > > > I was just thinking about that. Some code is very obfuscated due to
> > >
> > > No Sebastian, this is very obfuscated: http://www.cse.unsw.edu.au/~dons/pretty.html
> > >
> > > ;)
> > >
> > > I think saying obfuscated is very unfair. We took advantage of some strengths
> > > of Haskell, such as type inference, to reduce the number of lines. No
> > > worse than, say, the SML MLton entries do -- and why not leverage this advantage,
> > > since our language can do it?
> > >
> > > In fact, we have 1 line entries for some of the problems that are just
> > > not competitive, though very instructive. It would be nice to be able to
> > > publish those.
> >
> > I wasn't talking specifically about Haskell, but all languages (don't
> > like browsing around other languages only to see highly compact and
> > ugly solutions, which really don't give me a good taste for the
> > langugae).
> > Still, some Haskell implementations are clearly obfuscated to save
> > lines in certain circumstances (like: "thread im om = do (x::Int) <-
> > takeMVar im; putMVar om $! x+1; thread im om" int he cheap
> > concurrencybenchmark, most people don't write Haskell code with
> > semi-colons, and when they do they usually sequence them vertically,
> > not horizontally).
>
> Though often the case, using ; is not without precedent. A quick grep in the
> ghc source reveals many

Yeah sure, but it's quite obvious that in this case the source has
been intentionally obfuscated to reduce the number of lines. Perhaps
the use of several imports on one line separated by semi-colons is a
clearar example of that, though.

/S

--
Sebastian Sylvan
+46(0)736-818655
UIN: 44640862
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Shootout rankings

Isaac Gouy-2
In reply to this post by Donald Bruce Stewart
--- Donald Bruce Stewart <[hidden email]> wrote:
-snip-
> Ah! Just as I thought, SML really was trying very
> hard ;)

Quite possibly so, but no reason to follow down that
slippery slope ;)

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Shootout rankings

Simon Marlow-5
In reply to this post by Donald Bruce Stewart
Donald Bruce Stewart wrote:
> :D
>
> Haskell now ranked 2nd overall, only a point or so behind C:
>
>     http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all
>
> And still a bit more we can squeeze out...

Nice going, everyone who contributed!

Simon

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe