From: Vu Ngoc San <san.vu-ngoc@ujf-grenoble.fr>
To: Jon Harrop <jon@ffconsultancy.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] function definition
Date: Tue, 23 Jan 2007 12:44:27 +0100 [thread overview]
Message-ID: <45B5F51B.8060609@ujf-grenoble.fr> (raw)
In-Reply-To: <200701211742.51582.jon@ffconsultancy.com>
Thanks for the reply.
So, I have tried to do some benchmarking, and the results are surprising.
The method: a (for i=1 to ... do) loop.
I have tried first an inlined test with
ignore(binop1 Plus sin cos 1.)
(and then binop2, binop3, binop4)
Then I have defined the function
f = binop1 Plus sin cos
and tried the loop with
ignore(f 1.)
Here are the results
(Linux debian 2.6.17-2-686, Intel(R) Pentium(R) M processor 1300MHz)
BYTE CODE:
Inline binop1 with 100000000 iterations:58736 msec.
Inline binop2 with 100000000 iterations:59681 msec.
Inline binop3 with 100000000 iterations:67663 msec.
Inline binop4 with 100000000 iterations:68692 msec.
f (binop1) with 100000000 iterations:53514 msec.
f (binop2) with 100000000 iterations:47794 msec.
f (binop3) with 100000000 iterations:53315 msec.
f (binop4) with 100000000 iterations:59411 msec.
NATIVE CODE:
Inline binop1 with 100000000 iterations:25017 msec.
Inline binop2 with 100000000 iterations:25860 msec.
Inline binop3 with 100000000 iterations:26310 msec.
Inline binop4 with 100000000 iterations:24251 msec.
f (binop1) with 100000000 iterations:25512 msec.
f (binop2) with 100000000 iterations:25620 msec.
f (binop3) with 100000000 iterations:25554 msec.
f (binop4) with 100000000 iterations:24801 msec.
The last method (binop4) is clearly the slowest in bytcode and the
fastest in native code !
In native code, the difference bewteen the slowest and the fastest
reaches 8%.
This seems to me significant enough, but I don't know whether it depends
on the system architecture or not.
Best
San
prev parent reply other threads:[~2007-01-23 11:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-21 12:45 Vu Ngoc San
2007-01-21 17:42 ` [Caml-list] " Jon Harrop
2007-01-23 11:44 ` Vu Ngoc San [this message]
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=45B5F51B.8060609@ujf-grenoble.fr \
--to=san.vu-ngoc@ujf-grenoble.fr \
--cc=caml-list@yquem.inria.fr \
--cc=jon@ffconsultancy.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