caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Brian Hurt <bhurt@spnz.org>
To: Ville-Pertti Keinonen <will@exomi.com>
Cc: Ocaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Great Programming Language Shootout Revived
Date: Fri, 18 Jun 2004 10:38:45 -0500 (CDT)	[thread overview]
Message-ID: <Pine.LNX.4.44.0406181004460.4305-100000@localhost.localdomain> (raw)
In-Reply-To: <06D9583C-C0FD-11D8-8AC7-000393863F70@exomi.com>

On Fri, 18 Jun 2004, Ville-Pertti Keinonen wrote:

> Anyhow, the shootout seems, like most benchmarks, to be misleading and 
> arbitrary.  The language features compared are not really equivalent.  
> E.g. C, C++ and Ada should be approximately the same in performance for 
> code that doesn't compare their libraries or exception models.  Despite 
> doing things like disabling array index checks, it seems some of the 
> Ada benchmarks don't even use types equivalent to the C versions.

I agree.  Even worse, the majority exercise only small amounts of the 
language.  The tests array accesses, exception handling, method calls, 
nested loops, object instantiations, and string concatenation all 
explicitly test specific operations- with no regard for how often those 
options are actually implemented.  Take, for example, exception handling.  
The C version of this code uses setjmp()/longjmp().  Two functions which 
are rarely actually used in C code- the standard language pattern is to 
return an error code instead.  And other tests- notably ackerman's 
function and fibonacci numbers, are mainly dependent upon a similiarly 
small set of features (mainly speed of function calls).

"Artificial" doesn't begin to cover it.

As a side note, there is a reason why C++ is slower than C, even if you're 
compiling the exact same code.  C++ functions need to be able to handle 
exceptions and unroll the stack, even if the function itself doesn't throw 
or catch exceptions.  Even if unrolling the stack is a no-op, the function 
generally needs to be able to both be handed off from another function's 
stack unrolling, and hand off to another function's stack unrolling.  To 
remove this cost, the compiler needs to do a full program analysis, and 
basically detect "wait- you could compile this code with a C compiler, so 
I will compile this code with a C compiler!"  While this may be doable in 
theory, it's not going to happen in the real world.

Which raises another point.  Many languages, and C++ and Ocaml both
qualify, have "preferred" styles of programming, even if they admit other
styles.  For example, Ocaml "prefers" functional programming, it's the
default style, even as it allows imperitive and OO programming constructs.  
C++ "prefers" a template/OO style of coding, even as it admits C as
(basically) a proper subset.

If I were to sit down and start writting an application in Ocaml, 99% or 
more of it would be in a functional style.  How fast Ocaml is in 
imperitive or OO would not likely be all that important to the overall 
performance of my application.  Likewise, were I to write an application 
in C++, it's use templates, classes, virtual methods, etc.  If I wanted to 
write the application in C, I'd write it in C, not C++ and not Ocaml.  
Even if they involve a performance hit, they have other advantages (easier 
to write/debug code in, easier to use more advanced data structures, 
etc.).  This then raises the question of how much performance am I 
sacrificing for this increased power at the high level?

Plus there's the whole efficiency in the small vr.s efficiency in the 
large issue I mentioned earlier.  The GPLS measures almost entirely 
efficiency in the small.  Which isn't necessarily bad, just that it 
doesn't necessarily map to larger projects.

-- 
"Usenet is like a herd of performing elephants with diarrhea -- massive,
difficult to redirect, awe-inspiring, entertaining, and a source of
mind-boggling amounts of excrement when you least expect it."
                                - Gene Spafford 
Brian

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  parent reply	other threads:[~2004-06-18 15:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-17 18:05 Brian Hurt
2004-06-18  1:18 ` Yaron Minsky
2004-06-18  9:37   ` Sebastien Ferre
2004-06-18 15:45     ` Brian Hurt
2004-06-18 21:39       ` Eray Ozkural
2004-06-18  6:09 ` Brandon J. Van Every
2004-06-18  7:56 ` Ville-Pertti Keinonen
2004-06-18  8:59   ` skaller
2004-06-18  9:57     ` Ville-Pertti Keinonen
2004-06-18 10:48       ` Implementing DSLs in OCaml/CamlP4 (was: Re: [Caml-list] Great Programming Language Shootout Revived) Richard Jones
2004-06-18 12:32         ` Walid Taha
2004-06-18 15:38   ` Brian Hurt [this message]
2004-06-18 17:07     ` [Caml-list] Great Programming Language Shootout Revived David Brown
2004-06-19  0:26   ` Nicolas FRANCOIS
2004-06-19  9:04     ` [Caml-list] Benchmark suggestion (Was: Programming Language Shootout) Wolfgang Müller
2004-06-19 10:54       ` Ville-Pertti Keinonen
2004-06-19 19:38       ` [Caml-list] Benchmark suggestion Brandon J. Van Every
2004-06-19 20:08         ` Brian Hurt
2004-06-19 20:16         ` Wolfgang Müller
2004-06-20 11:24           ` [Caml-list] Evangelism Brandon J. Van Every
2004-06-19 11:18     ` [Caml-list] Great Programming Language Shootout Revived Ville-Pertti Keinonen
2004-06-19 11:56     ` Nicolas Janin
2004-06-19 12:51       ` Marcin 'Qrczak' Kowalczyk
2004-06-19 19:46         ` Brandon J. Van Every
2004-06-19 20:19           ` Brian Hurt
2004-06-19 12:09     ` Nicolas Janin
2004-06-19 12:48       ` John Hughes
2004-06-19 18:57       ` Brian Hurt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0406181004460.4305-100000@localhost.localdomain \
    --to=bhurt@spnz.org \
    --cc=caml-list@inria.fr \
    --cc=will@exomi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).