The ocamlnat project provides a new native code OCaml toplevel
ocamlnat, which is mostly compatible to the byte code toplevel
ocaml, but up to 100 times faster. It is based on the optimizing native code compiler, the native runtime and an earlier prototype by Alain Frisch. It is build upon Just-In-Time techniques and currently supports Unix-like systems (i.e. Linux, BSD or Mac OS X) running on x86 or x86-64 processors. Support for additional architectures and operating systems is planned, but not yet available.
See below for download links and installation instructions.
- Up to 100x faster than the byte code toplevel, as detailed here and here.
- Builtin Findlib support, available via
#use "topfind";;similar to the byte code toplevel.
Download the latest source code release ocamlnat-0.1.1.tar.bz2 (or any other release from the list above), and extract the source distribution tarball using the following command:
tar xjf ocamlnat-0.1.1.tar.bz2 cd ocamlnat-0.1.1
Assuming that you want to install ocamlnat into
/usr/local on a Unix-like system (i.e. Linux, BSD or Mac OS X), proceed as follows:
ocaml setup.ml -configure ocaml setup.ml -build
These are basically the standard configuration and build steps as described in the INSTALL file. Feel free to pass additional parameters the configuration phase if you need to.
The final step is to install
ocamlnat into the selected binary directory (i.e.
sudo ocaml setup.ml -install
Et voila, now you can use your new native toplevel
ocamlnat. Assuming that you installed it into
/usr/local, then you can execute it using the following command, which presents you with an interactive toplevel prompt, i.e.:
$ /usr/local/bin/ocamlnat ocamlnat version 0.1.1 (OCaml version 3.12.1) #
You can use it as a drop-in replacement for the byte code toplevel
ocaml in almost all cases, and enjoy a performance boost of up to 100x (compared to the byte code toplevel), as detailed here and here.
- Marcell Fischbach and Benedikt Meurer. "Towards a native toplevel for the OCaml language". Computing Research Repository (CoRR), Programming Languages (cs.PL), Oct 2011.
Available on GitHub: https://github.com/bmeurer/ocamlnat
Clone the project with Git by running:
git clone git://github.com/bmeurer/ocamlnat.git
If you come across any problems, please create a ticket and we will try to get it fixed as soon as possible.
Once you have made your commits:
- Fork ocamlnat.
- Create a topic branch - git checkout -b my_branch
- Push to your topic branch - git push origin my_branch
- Create a Pull Request from your topic branch.
- That's it!
Copyright © 2010-2011 Benedikt Meurer. See the LICENSE file for details.