caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Taras Glek <taras.judge@shaw.ca>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] JIT VM in OCaml: Impossible?
Date: Fri, 17 Aug 2007 12:50:00 +1000	[thread overview]
Message-ID: <1187319000.29691.24.camel@rosella.wigram> (raw)
In-Reply-To: <46C491E8.9010007@shaw.ca>

On Thu, 2007-08-16 at 11:05 -0700, Taras Glek wrote:

> > The question is: why would you do this? Why not just generate
> > C (or C++ as Felix does) and compile it to a shared library,
> > then link and execute it? 
> >   
> Because that would be bloody slow and depend on having a toolchain 
> installed? For a JIT you want a fast compiler that only compiles as 
> little as is needed.

Yes, it does depend on having a tool. Slow? No, not really:
[AMD64 2300 1G]:

(includes parsing the file)
skaller@rosella:/work/felix/svn/felix/felix/trunk$ time f hello
Hello World

real    0m2.073s
user    0m1.972s
sys     0m0.084s

(using cached parse)
skaller@rosella:/work/felix/svn/felix/felix/trunk$ time f hello
Hello World

real    0m1.026s
user    0m0.908s
sys     0m0.100s


(using cached binary)
skaller@rosella:/work/felix/svn/felix/felix/trunk$ time flx hello
Hello World

real    0m0.039s
user    0m0.016s
sys     0m0.012s

I suspect this is actually faster than any JIT, and there's
no question it is faster if the program is reused.

Don't forget: a program has to be compiled one way or the other.
Even Python is compiled to bytecode.  The tool above (Felix)
is better than a JIT because it does whole program optimisation,
generates machine binaries.

So I don't buy 'slow' as an argument: the technique is much
FASTER than any JIT system in all aspects, in fact it IS
a JIT compiler -- it just compiles the whole program all the
way from source with disk based caching which persists over
invocations.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


  reply	other threads:[~2007-08-17  2:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-16 14:10 Joel Reymont
2007-08-16 14:37 ` Sylvain Le Gall
2007-08-16 15:32   ` [Caml-list] " Oliver Bandel
2007-08-16 15:56     ` Joel Reymont
2007-08-16 16:15   ` Jon Harrop
2007-08-16 15:11 ` [Caml-list] " Oliver Bandel
2007-08-16 16:24 ` Gordon Henriksen
2007-08-16 17:37   ` skaller
2007-08-16 18:05     ` Taras Glek
2007-08-17  2:50       ` skaller [this message]
2007-08-17  3:09         ` Erick Tryzelaar
2007-08-17  5:42           ` skaller
2007-08-17  7:52             ` Joel Reymont
2007-08-17  8:36               ` Jon Harrop
2007-08-17  9:20                 ` Joel Reymont
2007-08-17  8:39         ` Jon Harrop
2007-08-16 18:49   ` Jon Harrop

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=1187319000.29691.24.camel@rosella.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@inria.fr \
    --cc=taras.judge@shaw.ca \
    /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).