caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Lex Stein <stein@eecs.harvard.edu>
To: Ocaml Mailing List <caml-list@inria.fr>
Subject: [Caml-list] comparison with C performance
Date: Thu, 1 May 2003 13:29:53 -0400 (EDT)	[thread overview]
Message-ID: <Pine.BSF.4.51.0305011303460.52091@bowser.eecs.harvard.edu> (raw)
In-Reply-To: <Pine.LNX.4.33.0305011021220.3160-100000@eagle.ancor.com>


Hi,

A while ago I built an NFS server in OCaml (BDBFS) and the performance
stunk. It was 10x slower than the BSD in-kernel NFS server for metadata
operations. There was some speculation about what was causing this
slowness. It could have been a number of things. So in order for my
Advisor to let me continue programming in OCaml, I set out to show that it
wasn't due to the choice of OCaml.

The experiment consisted of 10,000 repeated RPC cycles across a 100Mbps
link. An RPC cycle consists of a NULL RPC followed by an RPC with a 20 and
24 byte string that is written to a Berkeley-DB database (via DB->put)
with the 20 bytes as key and 24 bytes as value. The C test never leaves C
code and calls directly into the Berkeley-DB C code. The OCaml test leaves
C above the RPC layer and enters the OCaml world, using the OCaml
Berkeley-DB interface (the one I wrote, I know Yaron Minsky has one too)
to write to the database. The following column shows the time taken by a
client (the same client across all 3 test configurations) to execute
100,000 RPC cycles. I ran the experiment 15 times. The square brackets
contain the standard deviation. The units are seconds.

		Test run at 5:00am 04-27-2003
		100,000 RPC cycs
C shunt: 	22.87s [1.20s]
OCaml shunts:
  bytecode: 	23.87s [0.96s]
  native:       22.20s [0.98s]

The result is that the C and OCaml native and C and OCaml bytecode are
not differentiable, due to the relative standard deviations. The OCaml
bytecode and native are differentiable, being more than one standard
deviation away from each other.

To get back to the original story: this has pointed me in the direction of
improving BDBFS' performance by improving the efficiency of the directory
listing and lookup algorithms rather than changing languages. OCaml seems
to fare just fine against C.

Lex

On Thu, 1 May 2003, Brian Hurt wrote:

>
> Given the number of performance-related discussions in this maillist of
> late, I thought I'd forward this article:
> http://www-106.ibm.com/developerworks/java/library/j-jtp04223.html
>
> It's about Java, but I think it's still worthwhile reading for Ocaml
> programmers.  The lesson to learn here is that performance is tricky- what
> you think will obviously be a problem often isn't, and what you think
> won't be a problem can be.  Make it work correctly first, then measure
> performance, then enhance for performance if necessary.
>
> Another comment that applies to both languages is that if it's a glaringly
> obvious problem, the compiler people are probably already working on it
> (or possibly already solved it).
>
> 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
>

-------------------
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


  reply	other threads:[~2003-05-01 17:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-01 15:27 [Caml-list] OT: Java Performance Brian Hurt
2003-05-01 17:29 ` Lex Stein [this message]
2003-05-01 17:55   ` [Caml-list] comparison with C performance Miles Egan
2003-05-01 18:24     ` Lex Stein
2003-05-01 18:48       ` Miles Egan
2003-05-01 18:38     ` Lex Stein
2003-04-27 19:04       ` Chet Murthy
2003-05-01 19:08       ` Brian Hurt
2003-05-01 19:13   ` Eray Ozkural
2003-05-02  6:02 Gregory Morrisett

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.BSF.4.51.0305011303460.52091@bowser.eecs.harvard.edu \
    --to=stein@eecs.harvard.edu \
    --cc=caml-list@inria.fr \
    /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).